Mapbox-gl-native: MapView.onDestroy() hangs, freezes, does not return, ANRs when used in certain Activity/Fragment

Created on 30 Dec 2017  路  3Comments  路  Source: mapbox/mapbox-gl-native

In my app I use an Activity with Fragment with MapView. When I open this Activity and close it, MapView.onDestroy does-not-return causing an ANR

I have included a sample app showing this
MapBoxFreeze.zip

See traces.txt for the ANR
traces.txt

Platform: Android 8.1
Mapbox SDK version: mapbox-android-sdk:5.3.0

Steps to trigger behavior

  1. Launch the attached app
  2. Open the 2nd activity by clicking the 'popop' button
  3. Click android back button
  4. Observer freeze ANR

Expected behavior

Does not freeze

Actual behavior

Freezes

Most helpful comment

You need to call MapView#onDestroy as part of Fragment#onDestroyView and not Fragment#onDestroy

All 3 comments

In the sample app, please don't forget to add a working access token in MainActivity.java

I have commented out the calls the MapView.onDestroy() as a workaround. What is the effect of this?

You need to call MapView#onDestroy as part of Fragment#onDestroyView and not Fragment#onDestroy

Was this page helpful?
0 / 5 - 0 ratings