App crashes on bottom nav due to a fix on version 2.7.2 mapView.onDestroy(), mapView.removeAllViews()
See original GitHub issueEnvironment details
- com.google.maps.android:maps-compose:2.7.2
Steps to reproduce
- Clone this repo
- add your google api key to the manifest file
- Build the app
- Quickly navigate between the bottom tabs and check if the app will crash or not
- The app crashes big time
Sample Video
Stack trace
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.googlemapsbottomnav, PID: 3421
java.lang.NullPointerException: Attempt to invoke interface method 'void com.google.maps.api.android.lib6.impl.bq.z()' on a null object reference
at com.google.maps.api.android.lib6.impl.cv.l(:com.google.android.gms.dynamite_mapsdynamite@223017067@22.30.17 (100408-0):0)
at com.google.android.gms.maps.internal.q.ba(:com.google.android.gms.dynamite_mapsdynamite@223017067@22.30.17 (100408-0):2)
at et.onTransact(:com.google.android.gms.dynamite_mapsdynamite@223017067@22.30.17 (100408-0):4)
Observation
The app will not crash when it use the com.google.maps.android:maps-compose:2.7.0 version
Issue Analytics
- State:
- Created a year ago
- Reactions:2
- Comments:10 (3 by maintainers)
Top Results From Across the Web
MapView by Here crashes when calling mapView.onCreate in ...
In the first fragment, I initialize the map in onViewCreated and destroy it in onDestroyView. override fun onViewCreated(view: View, ...
Read more >app crash on iOS 16.1(beta) when u… - Apple Developer
It can fix this problem. I found it's Apple's bug because the new Navigation Title in iOS 16 is TitleControl Class. When you...
Read more >Solved: Arlo app crashes when mode is selected - Page 2
The new version solve some problems but give us at least one new: It crash everytime I try to press the mode tap....
Read more >Guide - HERE SDK for Android (Explore Edition)
This guide walks you through the first steps to build apps with the HERE SDK. ... In such a case, you do not...
Read more >Issues - android-maps-compose - Google Maps - Repos
App crashes on bottom nav due to a fix on version 2.7.2 mapView.onDestroy(), mapView.removeAllViews(). #207 opened 14 days ago by thekingrenz23.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@thekingrenz23 I see that you are using nested navigation for each screen composable, which is causing the problem.
If you use this I am not able to reproduce:
The crash does happen during onStart and will be most likely related to caching. I can dig more later.
@thekingrenz23 I hope that you can stay on the older version for a while unless we resolve this. I am trying to help and look at this, but I am also working, so I don’t have that much free time. @wangela would you be able to see where exactly in the obfuscated google maps code this is crashing? It does so during the start, so there must be some lifecycle caching during nested navigation and when switching navigation and destroying the view, google maps internally thinks something is still available. It could also be some race condition when it is destroyed and started again.