修复 Google API task-android-sample 的依赖关系
我正在尝试编译并运行 Google API 网站上的 task-android-sample 代码。我无法让它与 Maven 一起使用,所以我最终下载了所有的 jar 文件。以下是我所做的步骤:
1) 将下载的 task-android-sample 项目导入 Eclipse
2) 将 google-api-java-client-1.4.1-beta.zip jar 文件添加到我的项目中(构建路径,添加外部 jar )
3) 下载任务 API jar 文件并导入到我的项目中: http://code.google.com/p/google -api-java-client/wiki/APIs#Tasks_API
4) 勾选构建路径的 Order/Export 部分中的所有导入 jar 文件
5) 清理项目
6) 运行项目。
我收到以下错误: - ClientCredentials 无法解析为变量 - 无法解析导入 com.google.api.services.samples.shared。
我在 Google API 网站上搜索,找不到从哪里下载该文件。我进行了 Google 搜索,但找不到包含该类的 jar 文件。有人可以帮我解决这个依赖性问题吗?
更新:2011 年 9 月 20 日 ** 我按照此处指定的说明进行操作: http://samples.google-api -java-client.googlecode.com/hg/tasks-android-sample/instructions.html
“mvnsources:jar install”命令不会给我任何错误,但是当我运行“mvncompile”时,我得到出现以下错误:
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[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
[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
我已经按照 Apache 的说明验证了我的 Maven 安装,所以不确定为什么我仍然无法正确编译它。
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-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
[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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
现在这个问题已经解决了。请再试一次。感谢您报告问题。说明如下:
http ://samples.google-api-java-client.googlecode.com/hg/tasks-android-sample/instructions.html?r=default
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
上述问题已报告给google-api-java-client:
http://code.google.com/p /google-api-java-client/issues/detail?id=300
The above issue has been reported to google-api-java-client:
http://code.google.com/p/google-api-java-client/issues/detail?id=300