Fixing dependency for Google API task-android-sample
I'm trying to compile and run the task-android-sample code from Google's API website. I couldn't get it to work with Maven so I ended up downloading all the jar files. Below are the steps I did:
1) Import the downloaded task-android-sample project into Eclipse
2) Add google-api-java-client-1.4.1-beta.zip jar files to my project (Build path, add external jars)
3) Download Task API jar file and import to my project: http://code.google.com/p/google-api-java-client/wiki/APIs#Tasks_API
4) Check off all the import jar files in the Order/Export section of Build Path
5) Clean Project
6) Run Project.
I get the following errors: - ClientCredentials cannot be resolved into a variable - The import com.google.api.services.samples.shared cannot be resolved.
I searched in the Google API website and couldn't find where to download the file from. I did a Google search and couldn't find a jar file that would contain the class. Can someone help me to solve this dependency issue?
UPDATE: 9/20/11 ** I followed the instructions specified here: http://samples.google-api-java-client.googlecode.com/hg/tasks-android-sample/instructions.html
The "mvn sources:jar install" command does not give me any error, but when I run "mvn compile" I get the following errors:
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] <My_Path>/google-api-java-client.samples/tasks-androi开发者_开发问答d-sample/src/main/java/com/google/api/services/samples/tasks/android/TasksSample.java: [221,53] package R does not exist
[ERROR] <My_Path>/google-api-java-client.samples/tasks-android-sample/src/main/java/com/google/api/services/samples/tasks/android/TasksSample.java: [225,20] package R does not exist
[INFO] 2 errors
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.707s
[INFO] Finished at: Tue Sep 20 23:15:09 CDT 2011
[INFO] Final Memory: 9M/81M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.3.2:compile (default-compile) on project tasks-android-sample: Compilation failure: Compilation failure:
[ERROR] <My_Path>/google-api-java-client.samples/tasks-android-sample/src/main/java/com/google/api/services/samples/tasks/android/TasksSample.java:[221,53] package R does not exist
[ERROR] <My_Path>/google-api-java-client.samples/tasks-android-sample/src/main/java/com/google/api/services/samples/tasks/android/TasksSample.java: [225,20] package R does not exist
I already verify my maven installation as per Apache's instructions, so not sure why I can't still compile this properly.
This is now fixed. Please try it again. Thanks for reporting the problem. Instructions are here:
http://samples.google-api-java-client.googlecode.com/hg/tasks-android-sample/instructions.html?r=default
The above issue has been reported to google-api-java-client: http://code.google.com/p/google-api-java-client/issues/detail?id=300
精彩评论