io.opencensus.trace + proguard causing a crash
- Android Studio version: 3.6.1
- Firebase Component: Firestore (Database, Firestore, Storage, Functions, etc)
- Component version: 21.4.3
[REQUIRED] Step 3: Describe the problem
java.lang.RuntimeException: Internal error in Cloud Firestore (21.4.3) happens
Steps to reproduce:
shrinkResources true
minifyEnabled true
proguardFiles 'proguard-rules.pro'
and attempt to read a collection.
Error goes away if I put -keep class io.opencensus.trace.** {*;} in proguard-rules.pro.
Relevant Code:
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.havedone.android.debug, PID: 18702
java.lang.RuntimeException: Internal error in Cloud Firestore (21.4.3).
at com.google.firebase.firestore.util.AsyncQueue.lambda$panic$3(com.google.firebase:firebase-firestore@@21.4.3:534)
at com.google.firebase.firestore.util.AsyncQueue$$Lambda$3.run(Unknown Source:2)
at android.os.Handler.handleCallback(Handler.java:883)
at android.os.Handler.dispatchMessage(Handler.java:100)
at android.os.Looper.loop(Looper.java:214)
at android.app.ActivityThread.main(ActivityThread.java:7356)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930)
Caused by: java.lang.ExceptionInInitializerError
at io.opencensus.trace.unsafe.ContextUtils.getValue(ContextUtils.java:74)
at io.grpc.internal.CensusTracingModule$TracingClientInterceptor.interceptCall(CensusTracingModule.java:386)
at io.grpc.ClientInterceptors$InterceptorChannel.newCall(ClientInterceptors.java:156)
at io.grpc.internal.CensusStatsModule$StatsClientInterceptor.interceptCall(CensusStatsModule.java:691)
at io.grpc.ClientInterceptors$InterceptorChannel.newCall(ClientInterceptors.java:156)
at io.grpc.internal.ManagedChannelImpl.newCall(ManagedChannelImpl.java:814)
at io.grpc.internal.ForwardingManagedChannel.newCall(ForwardingManagedChannel.java:63)
at io.grpc.android.AndroidChannelBuilder$AndroidChannel.newCall(AndroidChannelBuilder.java:288)
at com.google.firebase.firestore.remote.GrpcCallProvider.lambda$createClientCall$0(com.google.firebase:firebase-firestore@@21.4.3:138)
at com.google.firebase.firestore.remote.GrpcCallProvider$$Lambda$1.then(Unknown Source:4)
at com.google.android.gms.tasks.zzf.run(Unknown Source:2)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:462)
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:1167)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
at com.google.firebase.firestore.util.AsyncQueue$SynchronizedShutdownAwareExecutor$DelayedStartFactory.run(com.google.firebase:firebase-firestore@@21.4.3:229)
at java.lang.Thread.run(Thread.java:919)
Caused by: java.lang.RuntimeException: java.lang.NoSuchMethodException: io.opencensus.trace.Span$Options.values []
at java.lang.Enum.enumValues(Enum.java:270)
at java.lang.Enum.access$000(Enum.java:61)
at java.lang.Enum$1.create(Enum.java:277)
at java.lang.Enum$1.create(Enum.java:275)
at libcore.util.BasicLruCache.get(BasicLruCache.java:63)
at java.lang.Enum.getSharedConstants(Enum.java:289)
at java.lang.Class.getEnumConstantsShared(Class.java:2428)
at java.util.EnumSet.getUniverse(EnumSet.java:407)
at java.util.EnumSet.noneOf(EnumSet.java:109)
at io.opencensus.trace.Span.<clinit>(Span.java:63)
at io.opencensus.trace.unsafe.ContextUtils.getValue(ContextUtils.java:74)
at io.grpc.internal.CensusTracingModule$TracingClientInterceptor.interceptCall(CensusTracingModule.java:386)
at io.grpc.ClientInterceptors$InterceptorChannel.newCall(ClientInterceptors.java:156)
at io.grpc.internal.CensusStatsModule$StatsClientInterceptor.interceptCall(CensusStatsModule.java:691)
at io.grpc.ClientInterceptors$InterceptorChannel.newCall(ClientInterceptors.java:156)
at io.grpc.internal.ManagedChannelImpl.newCall(ManagedChannelImpl.java:814)
at io.grpc.internal.ForwardingManagedChannel.newCall(ForwardingManagedChannel.java:63)
at io.grpc.android.AndroidChannelBuilder$AndroidChannel.newCall(AndroidChannelBuilder.java:288)
at com.google.firebase.firestore.remote.GrpcCallProvider.lambda$createClientCall$0(com.google.firebase:firebase-firestore@@21.4.3:138)
at com.google.firebase.firestore.remote.GrpcCallProvider$$Lambda$1.then(Unknown Source:4)
at com.google.android.gms.tasks.zzf.run(Unknown Source:2)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:462)
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:1167)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
at com.google.firebase.firestore.util.AsyncQueue$SynchronizedShutdownAwareExecutor$DelayedStartFactory.run(com.google.firebase:firebase-firestore@@21.4.3:229)
at java.lang.Thread.run(Thread.java:919)
Caused by: java.lang.NoSuchMethodException: io.opencensus.trace.Span$Options.values []
at java.lang.Class.getMethod(Class.java:2072)
at java.lang.Class.getDeclaredMethod(Class.java:2050)
at java.lang.Enum.enumValues(Enum.java:267)
at java.lang.Enum.access$000(Enum.java:61)
at java.lang.Enum$1.create(Enum.java:277)
at java.lang.Enum$1.create(Enum.java:275)
at libcore.util.BasicLruCache.get(BasicLruCache.java:63)
at java.lang.Enum.getSharedConstants(Enum.java:289)
at java.lang.Class.getEnumConstantsShared(Class.java:2428)
at java.util.EnumSet.getUniverse(EnumSet.java:407)
at java.util.EnumSet.noneOf(EnumSet.java:109)
at io.opencensus.trace.Span.<clinit>(Span.java:63)
at io.opencensus.trace.unsafe.ContextUtils.getValue(ContextUtils.java:74)
at io.grpc.internal.CensusTracingModule$TracingClientInterceptor.interceptCall(CensusTracingModule.java:386)
at io.grpc.ClientInterceptors$InterceptorChannel.newCall(ClientInterceptors.java:156)
at io.grpc.internal.CensusStatsModule$StatsClientInterceptor.interceptCall(CensusStatsModule.java:691)
at io.grpc.ClientInterceptors$InterceptorChannel.newCall(ClientInterceptors.java:156)
at io.grpc.internal.ManagedChannelImpl.newCall(ManagedChannelImpl.java:814)
at io.grpc.internal.ForwardingManagedChannel.newCall(ForwardingManagedChannel.java:63)
at io.grpc.android.AndroidChannelBuilder$AndroidChannel.newCall(AndroidChannelBuilder.java:288)
at com.google.firebase.firestore.remote.GrpcCallProvider.lambda$createClientCall$0(com.google.firebase:firebase-firestore@@21.4.3:138)
at com.google.firebase.firestore.remote.GrpcCallProvider$$Lambda$1.then(Unknown Source:4)
at com.google.android.gms.tasks.zzf.run(Unknown Source:2)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:462)
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:1167)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
at com.google.firebase.firestore.util.AsyncQueue$SynchronizedShutdownAwareExecutor$DelayedStartFactory.run(com.google.firebase:firebase-firestore@@21.4.3:229)
at java.lang.Thread.run(Thread.java:919)
@tomislavhofman I was unable to reproduce this on 21.4.3 using the friendly-eats app and the build rules you posted, which reads from collections. Could you provide a simple repro app that results in the behavior?
Looking at the stack trace, it appears that our grpc-java dependency is the root cause of this error. I'll look into adding the proguard rule temporarily into our SDK until grpc fixes this issue.
I have faced pretty the same issue
java.lang.RuntimeException: Internal error in Cloud Firestore (21.4.3).
at com.google.firebase.firestore.W.c.run(com.google.firebase:firebase-firestore@@21.4.3:5)
at android.os.Handler.handleCallback(Handler.java:883)
at android.os.Handler.dispatchMessage(Handler.java:100)
at android.os.Looper.loop(Looper.java:214)
at android.app.ActivityThread.main(ActivityThread.java:7397)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:935)
Caused by: java.lang.ExceptionInInitializerError
at io.grpc.M1.Z.a(CensusTracingModule.java:4)
at io.grpc.q.a(ClientInterceptors.java:1)
at io.grpc.M1.Q.a(CensusStatsModule.java:5)
at io.grpc.q.a(ClientInterceptors.java:1)
at io.grpc.M1.X2.a(ManagedChannelImpl.java:30)
at io.grpc.M1.x1.a(ForwardingManagedChannel.java:1)
at io.grpc.L1.f.a(AndroidChannelBuilder.java:2)
at com.google.firebase.firestore.V.G.a(com.google.firebase:firebase-firestore@@21.4.3:4)
at com.google.firebase.firestore.V.z.a(Unknown Source:4)
at com.google.android.gms.tasks.u.run(Unknown Source:1)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:462)
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:1167)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
at com.google.firebase.firestore.W.j.run(com.google.firebase:firebase-firestore@@21.4.3:3)
at java.lang.Thread.run(Thread.java:919)
Caused by: java.lang.RuntimeException: java.lang.NoSuchMethodException: e.a.e.p.values []
at java.lang.Enum.enumValues(Enum.java:270)
at java.lang.Enum.access$000(Enum.java:61)
at java.lang.Enum$1.create(Enum.java:277)
at java.lang.Enum$1.create(Enum.java:275)
at libcore.util.BasicLruCache.get(BasicLruCache.java:63)
at java.lang.Enum.getSharedConstants(Enum.java:289)
at java.lang.Class.getEnumConstantsShared(Class.java:2428)
at java.util.EnumSet.getUniverse(EnumSet.java:407)
at java.util.EnumSet.noneOf(EnumSet.java:109)
at e.a.e.q.<clinit>(Span.java:3)
at io.grpc.M1.Z.a(CensusTracingModule.java:4)
at io.grpc.q.a(ClientInterceptors.java:1)
at io.grpc.M1.Q.a(CensusStatsModule.java:5)
at io.grpc.q.a(ClientInterceptors.java:1)
at io.grpc.M1.X2.a(ManagedChannelImpl.java:30)
at io.grpc.M1.x1.a(ForwardingManagedChannel.java:1)
at io.grpc.L1.f.a(AndroidChannelBuilder.java:2)
at com.google.firebase.firestore.V.G.a(com.google.firebase:firebase-firestore@@21.4.3:4)
at com.google.firebase.firestore.V.z.a(Unknown Source:4)
at com.google.android.gms.tasks.u.run(Unknown Source:1)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:462)
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:1167)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
at com.google.firebase.firestore.W.j.run(com.google.firebase:firebase-firestore@@21.4.3:3)
at java.lang.Thread.run(Thread.java:919)
Caused by: java.lang.NoSuchMethodException: e.a.e.p.values []
at java.lang.Class.getMethod(Class.java:2072)
at java.lang.Class.getDeclaredMethod(Class.java:2050)
at java.lang.Enum.enumValues(Enum.java:267)
at java.lang.Enum.access$000(Enum.java:61)
at java.lang.Enum$1.create(Enum.java:277)
at java.lang.Enum$1.create(Enum.java:275)
at libcore.util.BasicLruCache.get(BasicLruCache.java:63)
at java.lang.Enum.getSharedConstants(Enum.java:289)
at java.lang.Class.getEnumConstantsShared(Class.java:2428)
at java.util.EnumSet.getUniverse(EnumSet.java:407)
at java.util.EnumSet.noneOf(EnumSet.java:109)
at e.a.e.q.<clinit>(Span.java:3)
at io.grpc.M1.Z.a(CensusTracingModule.java:4)
at io.grpc.q.a(ClientInterceptors.java:1)
at io.grpc.M1.Q.a(CensusStatsModule.java:5)
at io.grpc.q.a(ClientInterceptors.java:1)
at io.grpc.M1.X2.a(ManagedChannelImpl.java:30)
at io.grpc.M1.x1.a(ForwardingManagedChannel.java:1)
at io.grpc.L1.f.a(AndroidChannelBuilder.java:2)
at com.google.firebase.firestore.V.G.a(com.google.firebase:firebase-firestore@@21.4.3:4)
at com.google.firebase.firestore.V.z.a(Unknown Source:4)
at com.google.android.gms.tasks.u.run(Unknown Source:1)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:462)
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:1167)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
at com.google.firebase.firestore.W.j.run(com.google.firebase:firebase-firestore@@21.4.3:3)
at java.lang.Thread.run(Thread.java:919)
@thebrianchen I am currently in a bit of a rush and I can't really share whole project here. I could perhaps send you the project privately
@androks @tomislavhofman It seems that the underlying issue is that java.lang.EnumSet is being removed by proguard. Does making sure that enum fields are not being removed
(stackoverflow post) resolve the issue for you?
Closing the issue due to inactivity. Thanks @thebrianchen
It's been less than 48hours and there is an unsolved issue with the library, how is this inactive, what did I miss?
I didn't have time to test out the proposed solution and even then it's patch work. The crash shouldn't happen.
Has there been a pull request that I'm unaware of which adds the proguard rule?
Sry bout that. Mixed this up with a couple of other issues. Well have a fix out soon though
[update] adding the following rule to proguard-rules.pro fixes the issue: reference
-keepclassmembers enum * {
**[] $VALUES;
public *;
}
Any update on this? Experiencing the same issue with Cloud Firestore (21.4.3):
java.lang.RuntimeException: Internal error in Cloud Firestore (21.4.3).
at com.google.firebase.firestore.util.AsyncQueue$$Lambda$3.run(:1)
at android.os.Handler.handleCallback(Handler.java:883)
at android.os.Handler.dispatchMessage(Handler.java:100)
at android.os.Looper.loop(Looper.java:214)
at android.app.ActivityThread.main(ActivityThread.java:7356)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930)
Caused by: java.lang.ExceptionInInitializerError
at e.a.n0.o$e.a(:1)
at e.a.i$b.h(Unknown Source:4)
at e.a.n0.n$c.a(:2)
at e.a.i$b.h(Unknown Source:4)
at e.a.n0.i0.h(Unknown Source:2)
at e.a.n0.M.h(Unknown Source:2)
at e.a.m0.a$b.h(Unknown Source:2)
at com.google.firebase.firestore.remote.GrpcCallProvider.c(Unknown Source:8)
at com.google.firebase.firestore.remote.GrpcCallProvider$$Lambda$1.a(Unknown Source:4)
at c.b.a.b.g.o.run(Unknown Source:8)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:462)
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:1167)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
at com.google.firebase.firestore.util.AsyncQueue$SynchronizedShutdownAwareExecutor$DelayedStartFactory.run(Unknown Source:15)
at java.lang.Thread.run(Thread.java:919)
Caused by: java.lang.RuntimeException: java.lang.NoSuchMethodException: e.b.f.k$a.values []
at java.lang.Enum.enumValues(Enum.java:270)
at java.lang.Enum.access$000(Enum.java:61)
at java.lang.Enum$1.create(Enum.java:277)
at java.lang.Enum$1.create(Enum.java:275)
at libcore.util.BasicLruCache.get(BasicLruCache.java:63)
at java.lang.Enum.getSharedConstants(Enum.java:289)
at java.lang.Class.getEnumConstantsShared(Class.java:2428)
at java.util.EnumSet.getUniverse(EnumSet.java:407)
at java.util.EnumSet.noneOf(EnumSet.java:109)
at e.b.f.k.<clinit>(Unknown Source:8)
at e.a.n0.o$e.a(:1)
at e.a.i$b.h(Unknown Source:4)
at e.a.n0.n$c.a(:2)
at e.a.i$b.h(Unknown Source:4)
at e.a.n0.i0.h(Unknown Source:2)
at e.a.n0.M.h(Unknown Source:2)
at e.a.m0.a$b.h(Unknown Source:2)
at com.google.firebase.firestore.remote.GrpcCallProvider.c(Unknown Source:8)
at com.google.firebase.firestore.remote.GrpcCallProvider$$Lambda$1.a(Unknown Source:4)
at c.b.a.b.g.o.run(Unknown Source:8)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:462)
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:1167)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
at com.google.firebase.firestore.util.AsyncQueue$SynchronizedShutdownAwareExecutor$DelayedStartFactory.run(Unknown Source:15)
at java.lang.Thread.run(Thread.java:919)
Caused by: java.lang.NoSuchMethodException: e.b.f.k$a.values []`
`
Given that there seems to be no updates, I believe this old issue has been addressed and fixed. Please open a new ticket if you ever encounter the same issue again. Thanks!