我对Android和Google云相当陌生。我编写了一个成功写入firestore数据库的测试应用程序。 我想通过添加一个发布到pubsub主题的功能来扩展我的应用程序。 我将以下依赖行添加到build.gradle:
implementation 'com.google.cloud:google-cloud-pubsub:0.33.0-beta'
在我添加任何新的pubsub代码之前,我的应用程序使用以下堆栈跟踪构建,运行并立即崩溃:
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.tliv.mytestapp, PID: 27506
java.lang.RuntimeException: Internal error in Firestore (0.6.6-dev).
at com.google.android.gms.internal.zzeux.run(Unknown Source:23)
at android.os.Handler.handleCallback(Handler.java:790)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6494)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
Caused by: java.util.ServiceConfigurationError: Provider io.grpc.netty.NettyChannelProvider could not be instantiated: java.lang.ClassCastException: class io.grpc.netty.NettyChannelProvider cannot be cast to com.google.android.gms.internal.zzfmw
at com.google.android.gms.internal.zzfmw.zzq(Unknown Source:84)
at com.google.android.gms.internal.zzfmw.zzdcr(Unknown Source:26)
at com.google.android.gms.internal.zzfmw.<clinit>(Unknown Source:12)
at com.google.android.gms.internal.zzfmw.zzdcs(Unknown Source:0)
at com.google.android.gms.internal.zzfmv.zzud(Unknown Source:0)
at com.google.android.gms.internal.zzeti.<init>(Unknown Source:22)
at com.google.android.gms.internal.zzenf.zza(Unknown Source:74)
at com.google.android.gms.internal.zzenh.run(Unknown Source:8)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:457)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:301)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
at com.google.android.gms.internal.zzeuu$zza.run(Unknown Source:7)
at java.lang.Thread.run(Thread.java:764)
Caused by: java.lang.ClassCastException: class io.grpc.netty.NettyChannelProvider cannot be cast to com.google.android.gms.internal.zzfmw
at java.lang.Class.asSubclass(Class.java:2469)
at com.google.android.gms.internal.zzfmw.zzq(Unknown Source:2)
at com.google.android.gms.internal.zzfmw.zzdcr(Unknown Source:26)
at com.google.android.gms.internal.zzfmw.<clinit>(Unknown Source:12)
at com.google.android.gms.internal.zzfmw.zzdcs(Unknown Source:0)
at com.google.android.gms.internal.zzfmv.zzud(Unknown Source:0)
at com.google.android.gms.internal.zzeti.<init>(Unknown Source:22)
at com.google.android.gms.internal.zzenf.zza(Unknown Source:74)
at com.google.android.gms.internal.zzenh.run(Unknown Source:8)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:457)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:301)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
at com.google.android.gms.internal.zzeuu$zza.run(Unknown Source:7)
at java.lang.Thread.run(Thread.java:764)
我不知道从哪里开始排除故障。一旦我删除了pubsub依赖项,我的代码就会构建并再次正常运行。
答案 0 :(得分:0)
根据doc,&#34; Google Cloud Java客户端库目前不支持Android&#34;。
您可能希望使用Google Cloud Pub/Sub API Client Library替代项目。