我的应用从用户帐户访问电子表格,以前通过Google Plus登录按钮进行身份验证,在Google API控制台中选择了所有适当的范围和凭据,并且我已登录GoogleApiClient,我可以使用该帐户访问用户个人资料信息。
当我尝试初始化SpreadSheetService对象时:
SpreadsheetService service = new SpreadsheetService("SpreadSheetImport-v1");
我收到了与com.google.common.collect.Maps类相关的异常:
10-30 13:50:34.280: D/SHEETS(17433): TRYING TO GET SPREADSHEET LIST!
10-30 13:50:34.280: D/AndroidRuntime(17433): Shutting down VM
10-30 13:50:34.280: E/AndroidRuntime(17433): FATAL EXCEPTION: main
10-30 13:50:34.280: E/AndroidRuntime(17433): Process: com.pazodediarada.dc, PID: 17433
10-30 13:50:34.280: E/AndroidRuntime(17433): java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/common/collect/Maps;
10-30 13:50:34.280: E/AndroidRuntime(17433): at com.google.gdata.wireformats.AltRegistry.<init>(AltRegistry.java:118)
10-30 13:50:34.280: E/AndroidRuntime(17433): at com.google.gdata.wireformats.AltRegistry.<init>(AltRegistry.java:100)
10-30 13:50:34.280: E/AndroidRuntime(17433): at com.google.gdata.client.Service.<clinit>(Service.java:555)
10-30 13:50:34.280: E/AndroidRuntime(17433): at com.pazodediarada.dc.SpreadSheetImport.getSpreadSheetDeutschList(SpreadSheetImport.java:356)
10-30 13:50:34.280: E/AndroidRuntime(17433): at com.pazodediarada.dc.SpreadSheetImport.onClick(SpreadSheetImport.java:146)
10-30 13:50:34.280: E/AndroidRuntime(17433): at android.view.View.performClick(View.java:4438)
10-30 13:50:34.280: E/AndroidRuntime(17433): at android.view.View$PerformClick.run(View.java:18422)
10-30 13:50:34.280: E/AndroidRuntime(17433): at android.os.Handler.handleCallback(Handler.java:733)
10-30 13:50:34.280: E/AndroidRuntime(17433): at android.os.Handler.dispatchMessage(Handler.java:95)
10-30 13:50:34.280: E/AndroidRuntime(17433): at android.os.Looper.loop(Looper.java:136)
10-30 13:50:34.280: E/AndroidRuntime(17433): at android.app.ActivityThread.main(ActivityThread.java:5001)
10-30 13:50:34.280: E/AndroidRuntime(17433): at java.lang.reflect.Method.invoke(Native Method)
10-30 13:50:34.280: E/AndroidRuntime(17433): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785)
10-30 13:50:34.280: E/AndroidRuntime(17433): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
10-30 13:50:34.280: E/AndroidRuntime(17433): Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.common.collect.Maps" on path: DexPathList[[zip file "/data/app/com.pazodediarada.dc-2.apk"],nativeLibraryDirectories=[/data/app-lib/com.pazodediarada.dc-2, /vendor/lib, /system/lib]]
10-30 13:50:34.280: E/AndroidRuntime(17433): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
10-30 13:50:34.280: E/AndroidRuntime(17433): at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
10-30 13:50:34.280: E/AndroidRuntime(17433): at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
10-30 13:50:34.280: E/AndroidRuntime(17433): ... 14 more
10-30 13:50:34.280: E/AndroidRuntime(17433): Suppressed: java.lang.ClassNotFoundException: com.google.common.collect.Maps
10-30 13:50:34.280: E/AndroidRuntime(17433): at java.lang.Class.classForName(Native Method)
10-30 13:50:34.280: E/AndroidRuntime(17433): at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
10-30 13:50:34.280: E/AndroidRuntime(17433): at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
10-30 13:50:34.280: E/AndroidRuntime(17433): at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
10-30 13:50:34.280: E/AndroidRuntime(17433): ... 15 more
10-30 13:50:34.280: E/AndroidRuntime(17433): Caused by: java.lang.NoClassDefFoundError: Class "Lcom/google/common/collect/Maps;" not found
10-30 13:50:34.280: E/AndroidRuntime(17433): ... 19 more
我的IDE是Eclipse ADT,我按照Google Sheets Api导入了google api库,使用此处描述的方法或添加外部jar,获得相同的结果。
有什么想法吗?