mateilles718 / google-api-java-client

Automatically exported from code.google.com/p/google-api-java-client
0 stars 0 forks source link

Problem with directions in google-api-java-client #851

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Version of google-api-java-client (e.g. 1.15.0-rc)?

As of changeset:   294:1e428b90a3b4

Java environment (e.g. Java 6, Android 2.3, App Engine)?

Android

Describe the problem.

The instructions in:

http://samples.google-api-java-client.googlecode.com/hg/tasks-android-sample/ins
tructions.html

seem to not work.  Granted, I'm new to Gradle/Android-Gradle-Plugin, so there 
might be a simple fix, but the simple fixes I tried did not work.

First, the information under Register Your Application feels out of date, 
presumably they're from the previous developer console UI.  Specifically the 
given link now lands you with "Credentials" selected in the left bar, where you 
need to click "Create New Client ID", then select "Installed Application", pick 
"Android" type for "Installed application type" (no longer "platform"), and 
then enter the package name and SHA1 certificate fingerprint.  The command 
given does not output the sha1 in a format taken (now?) by the UI, so you need 
to instead use "openssl sha1 -c" to output with colon separators.  Finally you 
click "Create Client ID".

However, the bigger problem is that fact that the gradle file cannot be 
imported as a project into Android studio.  Since the package name needs to be 
changed, modifying the app outside of an Android IDE might be tricky (but will 
be my next attempt).

Specifically, if I follow the steps in instructions.html to point to the 
gradle-1.6 install and use the top level build.gradle, it says:

[ 140529]   WARN - ctExternalProjectImportBuilder - 
com.intellij.openapi.externalSystem.model.ExternalSystemException: You are 
using an old, unsupported version of Gradle. Please use version 1.8 or greater.

and fails to import.

I've tried:
a) Clicking "Use auto-import" which uses the built-in gradle 1.8 from 
android-studio I think.  That fails, saying "Project is using an old version of 
the Android Gradle plug-in. The minimum supported version is 0.6.1."
b) Installing gradle 1.8 (the same way as gradle 1.6 was installed) and 
pointing to it.  Same error as above.
c) Installing gradle 1.9 (same as above) and pointing to it.  That now says 
"Gradle version 1.6 is required. Current version is 1.9" (?!)

I've also tried changing the plugin version via the classpath in the top level 
build.gradle file:

--- a/build.gradle  Fri Sep 27 14:46:11 2013 +0100
+++ b/build.gradle  Fri Jan 03 12:50:18 2014 -0800
@@ -4,7 +4,7 @@
     }

     dependencies {
-        classpath 'com.android.tools.build:gradle:0.5.+'
+        classpath 'com.android.tools.build:gradle:0.7.0'
     }
 }

This then says "Gradle version 1.9 is required. Current version is 1.8. If 
using the gradle wrapper, try editing the distributionUrl in 
.../google-api-java-client-samples/gradle/wrapper/gradle-wrapper.properties to 
gradle-1.9-all.zip"

That gradle/wrapper directory does not exist.

Finally, if I switch to using both gradle-1.9 and changing the plugin classpath 
as above, I get this error "Cause: java.util.ArrayList cannot be cast to 
java.util.Map" which appears to happen with this stack:

    at com.android.tools.idea.gradle.project.ProjectImportErrorHandler.createUserFriendlyError(ProjectImportErrorHandler.java:204)
    at com.android.tools.idea.gradle.project.ProjectImportErrorHandler.getUserFriendlyError(ProjectImportErrorHandler.java:146)
    at com.android.tools.idea.gradle.project.AndroidGradleProjectResolver$1.fun(AndroidGradleProjectResolver.java:157)
    at com.android.tools.idea.gradle.project.AndroidGradleProjectResolver$1.fun(AndroidGradleProjectResolver.java:135)
    at org.jetbrains.plugins.gradle.service.project.GradleExecutionHelper.execute(GradleExecutionHelper.java:157)
    at com.android.tools.idea.gradle.project.AndroidGradleProjectResolver.resolveProjectInfo(AndroidGradleProjectResolver.java:135)
    at com.android.tools.idea.gradle.project.AndroidGradleProjectResolver.resolveProjectInfo(AndroidGradleProjectResolver.java:77)

How would you expect it to be fixed?

The instructions.html file (here and in other android projects which are mostly 
duplicates) should be fixed.  Possibly the gradle build stuff needs to be 
brought up to date.

Original issue reported on code.google.com by kmix...@google.com on 3 Jan 2014 at 9:21