PBandK 0.10.0.beta3 incompatible with Firebase Performance monitoring 19.0.10 or lower
See original GitHub issueI’ve found a side effect of updating the protobuf-javalite
version to 3.15.5
in 0.10.0.beta.3
: now pbandk
is only compatible with Firebase performance monitoring 19.0.11
(or higher): https://firebase.google.com/support/release-notes/android#performance_v19-0-11
This is because Firebase performance monitoring below 19.0.11
hasprotobuf-javalite:3.11.0
as a transitive dependency and when Gradle resolves this to a newer version (due to pbandk-runtime
), this causes a runtime crash when minification is enabled:
java.lang.RuntimeException: Unable to resume activity {<packagename>/<packagename>.MainActivity}: java.lang.ClassCastException: c.c.h.z0 cannot be cast to java.lang.String
at android.app.ActivityThread.performResumeActivity(ActivityThread.java:4444)
at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:4476)
at android.app.servertransaction.ResumeActivityItem.execute(ResumeActivityItem.java:52)
at android.app.servertransaction.TransactionExecutor.executeLifecycleState(TransactionExecutor.java:176)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:97)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2066)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:223)
at android.app.ActivityThread.main(ActivityThread.java:7656)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)
Caused by: java.lang.ClassCastException: c.c.h.z0 cannot be cast to java.lang.String
at c.c.h.j1.S(SourceFile:507)
at c.c.h.j1.Q(SourceFile:227)
at c.c.h.y0.e(SourceFile:77)
at c.c.h.y0.a(SourceFile:71)
at c.c.h.w1.d(SourceFile:90)
at c.c.h.w1.e(SourceFile:104)
at com.google.protobuf.GeneratedMessageLite.makeImmutable(SourceFile:175)
at com.google.protobuf.GeneratedMessageLite$b.n(SourceFile:397)
at com.google.protobuf.GeneratedMessageLite$b.l(SourceFile:405)
at com.google.firebase.perf.metrics.AppStartTrace.onActivityResumed(SourceFile:219)
at android.app.Application.dispatchActivityResumed(Application.java:436)
at android.app.Activity.dispatchActivityResumed(Activity.java:1379)
at android.app.Activity.onResume(Activity.java:1905)
at b.k.b.e.onResume(SourceFile:411)
at android.app.Instrumentation.callActivityOnResume(Instrumentation.java:1456)
at android.app.Activity.performResume(Activity.java:8135)
at android.app.ActivityThread.performResumeActivity(ActivityThread.java:4434)
at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:4476)
at android.app.servertransaction.ResumeActivityItem.execute(ResumeActivityItem.java:52)
at android.app.servertransaction.TransactionExecutor.executeLifecycleState(TransactionExecutor.java:176)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:97)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2066)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:223)
at android.app.ActivityThread.main(ActivityThread.java:7656)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)
Notice how nasty of a bug this is:
Minification needs to be enabled- This happens on implicitly loading Firebase performance monitoring via a
ContentProvider
at app startup -> so the stacktrace doesn’t have any meaningful information.
I think this could potentially be solvable by adding specific Proguard
exclusions to tackle this error, but I haven’t been able to pin down what those exceptions should be yet. Also I’m doubtful whether this is something that should be solved within pbandk
…
Should we maybe add a section with known issues to the release notes or readme?
Edit: minification is not required to reproduce this bug
Issue Analytics
- State:
- Created 3 years ago
- Comments:7 (5 by maintainers)
Top GitHub Comments
Ugh, that’s terrible. I’m quite surprised that a library like protobuf does not provide proper ABI compatibility between releases. But I just went digging in their docs and apparently the lite runtime has no compatibility guarantees 😞
From https://github.com/protocolbuffers/protobuf/blob/master/java/README.md#compatibility-notice:
And from https://github.com/protocolbuffers/protobuf/blob/master/java/lite.md:
I don’t understand how they could expect this to work when protobuf-javalite is a transitive dependency for so many other projects.
So basically, the issue is that the combination of
Crashes at runtime with message
com.google.protobuf.MapEntryLite cannot be cast to java.lang.String
And having
pbandk
as a dependency in a project might cause this, but likely other dependencies would as well.Solution is to update
firebase-perf
to19.0.11
or higher