Open ThinClient opened 1 year ago
I'm having the same issue did you solve it?
Seems to be an issue with the new code shrinker. I used the following rule and it works -keep class com.firebase.geofire.*{;}
Still not working for me.
After running with debugger, I think the actual issue is in the GenericTypeIndicator, probably getting obfuscated. I filed the issue here.
Does anyone found a solution for this? I think this library should be migrated to use the latest AGP version - otherwise we can still have issues like ClassCastException. Adding -keep class com.google.firebase.database.GenericTypeIndicator{*;} didn't work for me.
The only solution that worked for me was to disable the R8 full mode: android.enableR8.fullMode=false Reference: https://developer.android.com/build/shrink-code#full-mode
The library was last updated last year. I'm wondering if it's too mature to update or what. At this point I've given up on it. It's sad that firestore queries are not as good.
I'm currently using R8 and have been able to build by adding both lines to my proguard file. Using just one was not enough for me:
-keep class com.firebase.geofire.**{*;}
-keep class com.google.firebase.database.GenericTypeIndicator{*;}
My current setup includes: Android Studio Hedgehog | 2023.1.1 Patch 2 Gradle Wrapper 8.2
Root build.gradle:
classpath 'com.android.tools.build:gradle:8.2.2'
classpath 'com.google.gms:google-services:4.4.1'
App build.gradle:
implementation platform('com.google.firebase:firebase-bom:32.7.2')
implementation 'com.google.firebase:firebase-database'
implementation 'com.firebase:geofire-android:3.2.0'
Since GeoFire uses RealtimeDatabase I also include these lines from the RealtimeDatabase docs in my proguard file:
-keepattributes Signature
# This rule will properly ProGuard all the model classes in the package directory.
# Replace models with your folder of database model classes.
-keepclassmembers class your.package.name.models.** {
*;
}
I get the error below when trying to add a listener to a geofire query. I'm using R8 on my android project and don't know if it's the culprit.
Fatal Exception: java.lang.AssertionError: Got Datasnapshot without location with key at com.firebase.geofire.GeoQuery.childAdded(GeoQuery.java:275) at com.firebase.geofire.GeoQuery.access$000(GeoQuery.java:41) at com.firebase.geofire.GeoQuery$1.onChildAdded(GeoQuery.java:62) at com.google.firebase.database.core.ChildEventRegistration.fireEvent(ChildEventRegistration.java:79) at com.google.firebase.database.core.view.DataEvent.fire(DataEvent.java:63) at com.google.firebase.database.core.view.EventRaiser$1.run(EventRaiser.java:55) at android.os.Handler.handleCallback(Handler.java:938) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:246) at android.app.ActivityThread.main(ActivityThread.java:8625) at java.lang.reflect.Method.invoke(Method.java) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:602) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1130)