gpt4 book ai didi

java - Android 中用于谷歌云数据存储的谷歌 protobuf api

转载 作者:行者123 更新时间:2023-12-01 14:22:50 36 4
gpt4 key购买 nike

我正在尝试使用 Google 库从 Android 应用程序读取和写入 Google 云数据存储。

这个库是这样的:google-api-services-datastore-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

最后的问题是:

我应该如何从android访问谷歌云数据存储?

我开始认为这个库与 Android 不兼容......

谢谢

最佳答案

我发现错误是由 dx 组件给出的:似乎在 android 中不可能将外部 jar 库与名为 java.* 或 javax.* 的包一起使用

查看此链接:https://stackoverflow.com/a/11547272/223969

关于java - Android 中用于谷歌云数据存储的谷歌 protobuf api,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17402478/

36 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com