react-native-maps: App crashes when using Firebase and react-native-maps
Here is the stacktrace:
FATAL EXCEPTION: main
Process: com.example, PID: 9308
java.lang.NoSuchMethodError: No virtual method zztU()Lcom/google/android/gms/dynamic/LifecycleDelegate; in class Lcom/google/android/gms/maps/MapView$zzb; or its super classes (declaration of 'com.google.android.gms.maps.MapView$zzb' appears in /data/app/com.example-2/base.apk)
at com.google.android.gms.maps.MapView$zzb.zzzW(Unknown Source)
at com.google.android.gms.maps.MapView$zzb.zza(Unknown Source)
at com.google.android.gms.dynamic.zza.zza(Unknown Source)
at com.google.android.gms.dynamic.zza.onCreate(Unknown Source)
at com.google.android.gms.maps.MapView.onCreate(Unknown Source)
at com.airbnb.android.react.maps.AirMapView.<init>(AirMapView.java:70)
at com.airbnb.android.react.maps.AirMapManager.createViewInstance(AirMapManager.java:67)
at com.airbnb.android.react.maps.AirMapManager.createViewInstance(AirMapManager.java:26)
at com.facebook.react.uimanager.ViewManager.createView(ViewManager.java:44)
at com.facebook.react.uimanager.NativeViewHierarchyManager.createView(NativeViewHierarchyManager.java:205)
at com.facebook.react.uimanager.UIViewOperationQueue$CreateViewOperation.execute(UIViewOperationQueue.java:148)
at com.facebook.react.uimanager.UIViewOperationQueue$2.run(UIViewOperationQueue.java:760)
at com.facebook.react.uimanager.UIViewOperationQueue$DispatchUIFrameCallback.doFrameGuarded(UIViewOperationQueue.java:830)
at com.facebook.react.uimanager.GuardedChoreographerFrameCallback.doFrame(GuardedChoreographerFrameCallback.java:32)
at com.facebook.react.uimanager.ReactChoreographer$ReactChoreographerDispatcher.doFrame(ReactChoreographer.java:125)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:765)
at android.view.Choreographer.doCallbacks(Choreographer.java:580)
at android.view.Choreographer.doFrame(Choreographer.java:549)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:753)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5264)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:900)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:695)
P.S. I used manual installation, a.k.a. the com.airbnb.android.react.maps.MapsPackage and not via com.AirMaps.AirPackage. I’ve tried v0.4.2 and v0.5.0
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Reactions: 9
- Comments: 36 (10 by maintainers)
Commits related to this issue
- Disable Android Maps while we wait for https://github.com/lelandrichardson/react-native-maps/issues/249 — committed to DanceDeets/dancedeets-react by mikelambert 8 years ago
I was able to get the map running. This was my final gradle dependencies
Okay, figured it out. This in an incompatibility between Google Play Services 8.4 and Firebase 9.0 (ideally, they should probably be kept on the same version). The trick is to stop including version 8.4 and instead include your desired version 9.0)
My gradle ended up looking like this, though you will most likely need to understand what is going on in the below snippet to adapt it for your purposes.
I had a similar issue (react-native-maps + firebase apparently clashing) and this thread helped me fix it, so I thought I’d share. So basically when I added firebase, my app would crash with “Unfortunately, MyApp has stopped.”. I simple added
compile 'com.google.android.gms:play-services-maps:9.2.1'to myandroid/app/build.gradleand it magically fixed it.None of this has worked for me, but finally this did the trick.
On your android/app/build.gradle, just place above your dependencies:
@redwind Thank you for posting. Changing to 11.+ prevented the crash. When app launched user was prompted to update Google Play services when app launched.
I was using 11.4.2 and app crashed at start due to a firebase gms dependency.
I see current version is 11.7.44.
No sure if 11.+ is going to cause user Google Play update anxiety or not?
/android/app/build.gradle
My crash when using 11.4.2 : Lcom/google/android/gms/common/internal/zzbp
I got this error when adding
firebase-ads:11.6.0. Only solution was to upgrade all firebase components to11.8.0@bendellarocco suggestion worked perfectly for me 👍
A proper “fix” to work with Firebase, would be to upgrade react-native-maps’ dependencies to version 9.0.2 (or whatever the latest version of firebase is).
But I only use a tiny bit of maps functionality (basically a static map), and so cannot verify that such a major revision change doesn’t break any of the react-native-maps functionality/apis, and am not comfortable submitting such a pull request.
BTW, these are the things I needed to add to Gradle files: https://firebase.google.com/docs/android/setup
I’ve added
coreandmessaginglibraries.