2014-10-30 73 views
1

我的應用程序從用戶帳戶訪問電子表格,之前通過Google Plus登錄按鈕進行authenticad,在Google API控制檯中選擇了所有適當的作用域和憑據,並且我已登錄GoogleApiClient我可以訪問用戶配置文件信息。Android應用程序集成電子表格API

當我嘗試初始化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庫,兩者都使用這裏描述的方法或添加了外部罐子,獲得了相同的結果。

任何想法?

回答

2

找到了一個解決方案...這需要添加谷歌Guava庫。還有一個用於eclipse的插件。

相關問題