我正在关注Android指令中的Google Drive快速入门,并让它在Eclipse/Kepler中运行.(朱诺只是简单的狡猾.)但是,我对IntelliJ更熟悉,所以我试图找出如何以相应的方式安装这些API.
我想我已经开始使用Drive API部分了.Eclipse插件以某种特殊方式或位置安装Drive.我将Google-api-services-drive-v2-rev63-1.14.1-beta.jar添加为库,与其他库(Google-play-services和api_java_client)相同.但是,当我运行应用程序时,它会回来
java.lang.NoClassDefFoundError: com.google.api.client.googleapis.extensions.android.gms.auth.GoogleAccountCredential
Run Code Online (Sandbox Code Playgroud)
而且我还得到了一个与Drive $ Builder有关的NoClassDefFoundError.
在IntelliJ中,除了设置为"提供"的api_java_client库之外,.jar范围设置为"编译".他们都没有选中"导出".
编辑:添加模块和依赖项.我现在有一个不同的错误:
04-07 00:39:59.766: ERROR/AndroidRuntime(10697): FATAL EXCEPTION: main
java.lang.NoClassDefFoundError:
com.google.api.client.googleapis.extensions.android.gms.auth.GoogleAccountCredential
at com.fallinghawks.weight4.App.onCreate(App.java:15)
Run Code Online (Sandbox Code Playgroud)
App.java:15是
credential = GoogleAccountCredential.usingOAuth2(this, DriveScopes.DRIVE);
Run Code Online (Sandbox Code Playgroud)
我可以找到它要求的课程....
编辑2,按照CrazyCoder的说明添加库: 它编译,运行,但是我收到以下错误.我确信我错过了做正确的事情,我会在一分钟内再次尝试,但与此同时错误是:
04-10 18:02:35.120: ERROR/AndroidRuntime(740): FATAL EXCEPTION: main
java.lang.ExceptionInInitializerError
at com.google.api.services.drive.Drive$Builder.build(Drive.java:7301)
at com.example.DriveQuickstart.MyActivity.getDriveService(MyActivity.java:110)
at com.example.DriveQuickstart.MyActivity.onActivityResult(MyActivity.java:49)
at android.app.Activity.dispatchActivityResult(Activity.java:5293)
at android.app.ActivityThread.deliverResults(ActivityThread.java:3315)
at android.app.ActivityThread.handleSendResult(ActivityThread.java:3362)
at android.app.ActivityThread.access$1100(ActivityThread.java:141)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1282)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:5041)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.NoClassDefFoundError: com.google.common.base.Preconditions …Run Code Online (Sandbox Code Playgroud)