2013-07-01 176 views
0

我想用谷歌lib讀取和谷歌雲數據存儲從Android應用程序內寫入。谷歌protobuf api在android谷歌雲數據存儲

圖書館是這一個: 谷歌的API服務的數據存儲-的protobuf-java的v1beta1-rev1-1.0.0

我已經取得使用這個庫,所有正在一個std Java項目。 在Android中,當我嘗試編譯它,我得到這個錯誤:

[2013-07-01 12:54:33 - AndroidDatastore] Dx 1 error; aborting 
[2013-07-01 12:54:33 - AndroidDatastore] Conversion to Dalvik format failed with error 1 

所以我試圖導入源API太多,但有數百個錯誤

過了一會兒,我解決了這個問題,並且應用程序啓動在Android,但我得到這個運行時錯誤:

07-08 11:14:26.002: I/dalvikvm(14946): Could not find method com.google.api.services.datastore.DatastoreV1$Entity.newBuilder, referenced from method it.micrel.androiddatastore.MainActivity.addEntry 
07-08 11:14:26.002: W/dalvikvm(14946): VFY: unable to resolve static method 9: Lcom/google/api/services/datastore/DatastoreV1$Entity;.newBuilder()Lcom/google/api/services/datastore/DatastoreV1$Entity$Builder; 
07-08 11:14:26.002: D/dalvikvm(14946): VFY: replacing opcode 0x71 at 0x0002 
07-08 11:14:26.002: E/dalvikvm(14946): Could not find class 'com.google.api.services.datastore.client.DatastoreOptions$Builder', referenced from method it.micrel.androiddatastore.MainActivity.connectToDatastore 
07-08 11:14:26.002: W/dalvikvm(14946): VFY: unable to resolve new-instance 32 (Lcom/google/api/services/datastore/client/DatastoreOptions$Builder;) in Lit/micrel/androiddatastore/MainActivity; 
07-08 11:14:26.002: D/dalvikvm(14946): VFY: replacing opcode 0x22 at 0x0000 
07-08 11:14:26.012: I/dalvikvm(14946): Could not find method com.google.api.services.datastore.DatastoreV1$BlindWriteRequest.newBuilder, referenced from method it.micrel.androiddatastore.MainActivity.insertAutoId 
07-08 11:14:26.012: W/dalvikvm(14946): VFY: unable to resolve static method 5: Lcom/google/api/services/datastore/DatastoreV1$BlindWriteRequest;.newBuilder()Lcom/google/api/services/datastore/DatastoreV1$BlindWriteRequest$Builder; 
07-08 11:14:26.012: D/dalvikvm(14946): VFY: replacing opcode 0x71 at 0x0000 
07-08 11:14:26.012: I/dalvikvm(14946): Could not find method com.google.api.services.datastore.DatastoreV1$Query.newBuilder, referenced from method it.micrel.androiddatastore.MainActivity.listEntry 
07-08 11:14:26.012: W/dalvikvm(14946): VFY: unable to resolve static method 16: Lcom/google/api/services/datastore/DatastoreV1$Query;.newBuilder()Lcom/google/api/services/datastore/DatastoreV1$Query$Builder; 
07-08 11:14:26.012: D/dalvikvm(14946): VFY: replacing opcode 0x71 at 0x0000 
07-08 11:14:26.012: I/dalvikvm(14946): Could not find method com.google.api.services.datastore.DatastoreV1$RunQueryRequest.newBuilder, referenced from method it.micrel.androiddatastore.MainActivity.runQuery 
07-08 11:14:26.012: W/dalvikvm(14946): VFY: unable to resolve static method 21: Lcom/google/api/services/datastore/DatastoreV1$RunQueryRequest;.newBuilder()Lcom/google/api/services/datastore/DatastoreV1$RunQueryRequest$Builder; 
07-08 11:14:26.012: D/dalvikvm(14946): VFY: replacing opcode 0x71 at 0x0000 
07-08 11:14:26.012: W/dalvikvm(14946): VFY: unable to find class referenced in signature (Lcom/google/api/services/datastore/client/Datastore;) 
07-08 11:14:26.022: W/dalvikvm(14946): VFY: unable to resolve exception class 29 (Lcom/google/api/services/datastore/client/DatastoreException;) 
07-08 11:14:26.022: W/dalvikvm(14946): VFY: unable to find exception handler at addr 0x68 
07-08 11:14:26.022: W/dalvikvm(14946): VFY: rejected Lit/micrel/androiddatastore/MainActivity;.onCreate (Landroid/os/Bundle;)V 
07-08 11:14:26.022: W/dalvikvm(14946): VFY: rejecting opcode 0x0d at 0x0068 
07-08 11:14:26.022: W/dalvikvm(14946): VFY: rejected Lit/micrel/androiddatastore/MainActivity;.onCreate (Landroid/os/Bundle;)V 
07-08 11:14:26.022: W/dalvikvm(14946): Verifier rejected class Lit/micrel/androiddatastore/MainActivity; 
07-08 11:14:26.022: W/dalvikvm(14946): Class init failed in newInstance call (Lit/micrel/androiddatastore/MainActivity;) 
07-08 11:14:26.092: D/AndroidRuntime(14946): Shutting down VM 
07-08 11:14:26.092: W/dalvikvm(14946): threadid=1: thread exiting with uncaught exception (group=0x40aac210) 
07-08 11:14:26.202: E/AndroidRuntime(14946): FATAL EXCEPTION: main 
07-08 11:14:26.202: E/AndroidRuntime(14946): java.lang.VerifyError: it/micrel/androiddatastore/MainActivity 
07-08 11:14:26.202: E/AndroidRuntime(14946): at java.lang.Class.newInstanceImpl(Native Method) 
07-08 11:14:26.202: E/AndroidRuntime(14946): at java.lang.Class.newInstance(Class.java:1319) 
07-08 11:14:26.202: E/AndroidRuntime(14946): at android.app.Instrumentation.newActivity(Instrumentation.java:1023) 
07-08 11:14:26.202: E/AndroidRuntime(14946): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1882) 
07-08 11:14:26.202: E/AndroidRuntime(14946): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1992) 
07-08 11:14:26.202: E/AndroidRuntime(14946): at android.app.ActivityThread.access$600(ActivityThread.java:127) 
07-08 11:14:26.202: E/AndroidRuntime(14946): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1158) 
07-08 11:14:26.202: E/AndroidRuntime(14946): at android.os.Handler.dispatchMessage(Handler.java:99) 
07-08 11:14:26.202: E/AndroidRuntime(14946): at android.os.Looper.loop(Looper.java:137) 
07-08 11:14:26.202: E/AndroidRuntime(14946): at android.app.ActivityThread.main(ActivityThread.java:4448) 
07-08 11:14:26.202: E/AndroidRuntime(14946): at java.lang.reflect.Method.invokeNative(Native Method) 
07-08 11:14:26.202: E/AndroidRuntime(14946): at java.lang.reflect.Method.invoke(Method.java:511) 
07-08 11:14:26.202: E/AndroidRuntime(14946): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:823) 
07-08 11:14:26.202: E/AndroidRuntime(14946): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:590) 
07-08 11:14:26.202: E/AndroidRuntime(14946): at dalvik.system.NativeStart.main(Native Method) 
07-08 11:14:32.558: I/Process(14946): Sending signal. PID: 14946 SIG: 9 

最終的問題是:

如何768,16訪問谷歌雲數據存儲從android?

我開始思考,這個庫不與Android兼容...

謝謝

+1

這在Android SDK的版本,您使用的:無法在此鏈接在這裏使用該包裝的外部JAR庫命名的Java *或*的javax

看看。? – proppy

+0

對不起。我正在使用這個:ADT v。22.0.1 – FrankPak

回答

1

我發現該錯誤是由DX組件給出:似乎在Android的是https://stackoverflow.com/a/11547272/223969

+0

此外,它仍然是一個ssl庫的問題,似乎Android沒有內置的支持。 – FrankPak

+0

您可以嘗試下面的pull請求,從uber jar中排除javax。*:https://github.com/GoogleCloudPlatform/google-cloud-datastore/pull/8 – proppy

+1

這應該使用'v1beta1-rev2'版本修復 – proppy