This repository was archived by the owner on Aug 8, 2023. It is now read-only.
Repository navigation
This repository was archived by the owner on Aug 8, 2023. It is now read-only.
Offline downloading blocking return of mapboxMap object #11461
Copy link
Copy link
Closed
Description
Using the Map SDK 5.5.0 if you download a region, leave the activity and return to the same activity with the mapView, the OnMapReady callback gets held up by what I assume is an attempt to read the "file source".
03-15 14:29:11.505 5222-5222/com.mapbox.mapboxsdk.plugins.testapp E/FileSource: Failed to read the storage key:
java.lang.NullPointerException: Attempt to invoke virtual method 'boolean android.os.Bundle.getBoolean(java.lang.String, boolean)' on a null object reference
at com.mapbox.mapboxsdk.storage.FileSource.getCachePath(FileSource.java:69)
at com.mapbox.mapboxsdk.storage.FileSource.getInstance(FileSource.java:48)
at com.mapbox.mapboxsdk.maps.MapView.onStart(MapView.java:349)
at com.mapbox.mapboxsdk.plugins.offline.ui.RegionSelectionFragment.onStart(RegionSelectionFragment.java:97)
at android.support.v4.app.Fragment.performStart(Fragment.java:2287)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1458)
at android.support.v4.app.FragmentManagerImpl.moveFragmentToExpectedState(FragmentManager.java:1750)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1819)
at android.support.v4.app.FragmentManagerImpl.dispatchStateChange(FragmentManager.java:3227)
at android.support.v4.app.FragmentManagerImpl.dispatchStart(FragmentManager.java:3186)
at android.support.v4.app.FragmentController.dispatchStart(FragmentController.java:203)
at android.support.v4.app.FragmentActivity.onStart(FragmentActivity.java:582)
at android.support.v7.app.AppCompatActivity.onStart(AppCompatActivity.java:177)
at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1334)
at android.app.Activity.performStart(Activity.java:7019)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2741)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2856)
at android.app.ActivityThread.-wrap11(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1589)
at android.os.Handler.dispatchMessage(Handler.java:106)
Eventually, the callback is invoked, a MapboxMap object is available but no map style is loaded (only the background).
cc: @mapbox/maps-android

Activity
LukasPaczos commentedon Mar 16, 2018
@cammace could you ensure that there is no other native stack trace before the one you posted? I've seen a situation when
NullPointerException: Attempt to invoke virtual method 'boolean android.os.Bundle.getBoolean(java.lang.String, boolean)' on a null object referencewas thrown just after a native crash.cammace commentedon Mar 19, 2018
Can confirm that i'm not seeing any native crashes, @tobrun mentioned this could be related to #11147.
dylan-chong commentedon Jun 25, 2018
Sorry to bug you all but is this bug still being worked on?
Also did anyone find any workarounds while this bug is still being fixed?
neslihanturan commentedon Jul 30, 2018
We also get very similar error on another project which uses mapbox. Is it a bug that is caused from mapbox-android or do we misinterpret logs? If so, did you find a solution for this?
tobrun commentedon Aug 13, 2018
OnMapReady invocation is linked to style loading which is blocked as the queue in filesource is filled up with offline resources that will be handled first. In #12219 we have a solution outlined that decouples OnMapReady invocation from style loading.
tobrun commentedon Aug 15, 2018
@neslihanturan @dylan-chong
would you be able to retest with a more recent version? eg 6.3.0 (6.4.0 will be released later today) In gif below I'm downloading a large region on application start (clean install), while the map takes a couple seconds to load, it shows as expected:
tobrun commentedon Aug 16, 2018
While in 6.4.0 this issue seems less apparant, it is still there. Fixing this issue at core level is ticketed in #12655. Closing this issue as the solution for this issue is outlined in #12655.