DriveQuickstart sample project in Android Studio - google-drive-api

Can you please provide some guide how to create DriveQuickstart demo application (https://developers.google.com/drive/quickstart-android, steps 2-3) in Android Studio?
The problem is that Android Studio can't find com.google.api.* classes, like com.google.api.client.googleapis.extensions.android.gms.auth.GoogleAccountCredential. And I can't find it neither in google-play-services.jar, not in Android SDK folders.
I use "Compile with: Google APIs 17" in Android Studio, I downloaded all the latest updates in SDK manager (including Google APIs for API17, Google Play services, Google Repository).
According to http://developer.android.com/google/play-services/setup.html I added
dependencies {
compile 'com.android.support:appcompat-v7:+'
compile 'com.google.android.gms:play-services:4.1.+'
}
in build.gradle. What other actions should I perform to compile the sample source code, add some external library? You have provided great detailed steps for Eclipse, but said nothing about Android Studio with Gradle.

Try adding this to project build.gradel,worked for me in android studio 0.4.3,
sync and then optimize imports(Ctrl+Alt+O) in windows.
compile 'com.android.support:appcompat-v7:19.0.1'
compile 'com.google.android.gms:play-services:4.1.32'
compile('com.google.api-client:google-api-client-xml:1.17.0-rc') {
exclude group: 'com.google.android.google-play-services'
}
compile 'com.google.http-client:google-http-client-gson:1.17.0-rc'
compile('com.google.api-client:google-api-client-android:1.17.0-rc') {
exclude group: 'com.google.android.google-play-services'
}
compile 'com.google.apis:google-api-services-drive:v2-rev105-1.17.0-rc'
Credits go to user #smokybob

In the Quickstart, did you follow all of the items in Step 2?
Specifically it looks like you missed out the last two (confusingly numbered 1 & 2 which install the Google Client Libs into your project. Open the "libs" folder in your project and check that you have a bunch of client libs such as "googleapi-client.jar".

Related

How to enable autocomplete for Google Apps Script in locally-installed IDE

I'm trying to build GAS projects locally using clasp.
Any locally-installed IDE is a huge improvement over Google's Script Editor, so the tool looks very promising. Unfortunately, the autocomplete feature for GAS services doesn't seem to be included in the package.
The documentation says:
The Apps Script CLI uses TypeScript to provide autocompletion and linting when developing. Use an IDE like Visual Studio Code for TypeScript autocompletion.
After going through the steps and installing all required dependencies, I'm still unable to get the autocomplete feature to work. When I execute the clasp pull command for the existing project, it converts the ".gs" extension to ".js". The autocomplete suggestions are simply the result of parsing existing code.
For example, if I call sheet.getRange() somewhere in my code, then the getRange() method will pop up in suggestions, but I can't list available options for, say, PropertiesService, unless it's already used in my code.
Has anybody had any luck with enabling autocomplete feature for Google Apps Script?
I found the solution that partially works, but it may not be applicable to other software. The steps below are for Visual Studio Code:
Install the NPM package containing type definitions for GAS using
https://www.npmjs.com/package/#types/google-apps-script
In your locally-saved script, create a '.js' file and type
import 'google-apps-script';
This answer is a minor variation on the accepted one for IDEs/extensions which support Typescript auto completion based on tsc/tsserver:
Install TypeScript and #types/google-apps-script
https://www.npmjs.com/package/typescript
https://www.npmjs.com/package/#types/google-apps-script
Create a jsconfig.json file in your local project directory:
{
"compilerOptions": {
"checkJs": true
}
}
Alternatively, If you're using typescript along with javascript, then create a tsconfig.json:
{
"compilerOptions": {
"allowJs": true,
"checkJs": true,
"types": ["google-apps-script"]
}
}
Include both filenames in .claspignore, if you're using clasp and if the file is in your local directory.
You can also use any of this config globally, if the config is in your home/parent directory, as tsc searches for this config from project/local folder to root(in which case, you don't need to include it in .claspignore).
If you are using any JetBrains IDE:
Go to Languages & Frameworks -> JavaScript -> Libraries -> Download... and download the library google-apps-script.
Try including the file name, import.js in .claspignore (docs).
This should save some trouble deleting the file before each push every time.
This is an answer provided by Google developers in the "TU17: Enhancing the Google Apps Script Developer Experience with clasp and TypeScript" video.
Add a JavaScript file to your project like "appscript.js" and, in that file, add:
import "google-apps-script";
Save that file but make sure to ignore it when pushing files back to your project using a .claspignore file.

Package libgdx game for desktop

I primarily use LibGDX to develop games for Android. It is helpful to test on the desktop. When I do so, I just set the "desktop" project in Android Studio to use the assets from the "android" project, as described here. This works great on my local machine for testing purposes. However, it won't work if I want to package my game and release it for other's to play on their own machines. How do I go about packaging my game to include the graphic and audio assets?
I stumbled on the following snippet in the build.gradle file:
task dist(type: Jar) {
from files(sourceSets.main.output.classesDir)
from files(sourceSets.main.output.resourcesDir)
from {configurations.compile.collect {zipTree(it)}}
from files(project.assetsDir);
manifest {
attributes 'Main-Class': project.mainClassName
}
}
This appears to bundle project.assetsDir into the JAR file created by the dist task which is set as
project.ext.assetsDir = new File("../android/assets");
To run the above task from the command line, type
gradlew desktop:dist

Why is StrobeMediaPlayer.swf 253k in the "for Flash Player X" folder but 433k when compiled or in player/bin folder?

I have been trying to compile StrobeMediaPlayback from source; I've managed to compile the project using ANT with the Flex 4.5.1 or Flex 6 SDK and also successfully compiled using Flash Builder 4.5 (as recommended by the project).
In all cases, compiling the SMP project results in a 433k StrobeMediaPlayback.swf. Also, StrobeMediaPlayback.swf located in src/player/StrobeMediaPlayback/bin/StrobeMediaPlayback.swf ships as 433k. My question then, is how on earth do I compile StrobeMediaPlayback.swf to 253k as it exists in the for Flash Player 10.1 folder? It appears there is an external OSMF.swc file in this folder that is 233k - typically this gets bundled with the build... however, I can drop the 253k StrobeMediaPlayback.swf into a new project without the OSMF.swc file and it works fine.
So, if it turns out that I need to compile StrobeMediaPlayback without bundling the OSMF.swc, can someone point me in the right direction on how to do this?
Relevant installation documentation that was impossible to find: http://osmf.org/dev/osmf/specpdfs/building-osmf.pdf
So, if it turns out that I need to compile StrobeMediaPlayback without bundling the OSMF.swc, can someone point me in the right direction on how to do this?
Try,
in your StrobeMediaPlayback project, mark the osmf.swc as an external library.
(Project > Properties > Application Build Path > Library Path > OSMF > Link Type)

FDT - Create a Project with existing source files, assets, folders etc

I am using FDT 5 and would like to create a new project with already existing source files and assets. When I start up the Project Wizard (New->FDT Project) I browse to the folder I want to make as the project but I cannot proceed as FDT gives me the error:
*"PROJECT_NAME overlaps the location of another project: PROJECT_NAME"*
I have downloaded a flash project (developed in FDT) and would just simply like to make it a project in my FDT environment.
I mean this shouldn't be so complicated right? I don't want to create an entirely new project (its own folder) I want to use the same folder I downloaded and view that project. I am using git so I have to work in the same path, sort of speak.
Any ideas?
EDIT:
Apparently this is an issue with FDT, a small bug. I managed to solve the problem following this:
FDT / Eclipse Error : ‘overlaps the location of another project’
And on the eclipse forum:
Eclipse Forum

Manifest references file 'Bing.Maps.dll' which is not part of the payload

Error 1 Manifest references file 'Bing.Maps.dll' which is not part of the payload. C:\Users\xxx\Desktop\xxx\Applicationxx\Applicationxx\Package.appxmanifest Application7
I added this into a existing Metro application and its giving me that error, anyone has solution to it?
Go to the properties of the project and under Build, you will see Platform Target. Choose either x64 or x86 instead of Any CPU and it should be solved.
~Guo Hong
To correctly reference Bing Maps for a Metro app...
Go to: Project -> Add Reference -> Windows -> Extensions
Now, select both the "Bing Maps for ..." and also "Microsoft Visual C++ Runtime Package"
If you don't select the 2nd package, things will seem to be fine until you try to actually deploy your app.