Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

Fatal Exception: com.mapbox.mapboxsdk.exceptions.MapboxConfigurationException #11998

Closed
waar19 opened this issue May 24, 2018 · 4 comments
Closed
Labels
Android Mapbox Maps SDK for Android needs information

Comments

@waar19
Copy link

waar19 commented May 24, 2018

This error ocurred sometimes but is not ever

The token is configured and ocurred in some devices

Fatal Exception: com.mapbox.mapboxsdk.exceptions.MapboxConfigurationException:
Using MapView requires setting a valid access token. Use Mapbox.getInstance(Context context, String accessToken) to provide one.
Please see https://www.mapbox.com/help/create-api-access-token/ to learn how to create one.
More information in this guide https://www.mapbox.com/help/first-steps-android-sdk/#access-tokens.
at com.mapbox.mapboxsdk.Mapbox.validateMapbox(Unknown Source)
at com.mapbox.mapboxsdk.Mapbox.getAccessToken(Unknown Source)
at com.mapbox.mapboxsdk.storage.FileSource.(Unknown Source)
at com.mapbox.mapboxsdk.storage.FileSource.getInstance(Unknown Source)
at com.mapbox.mapboxsdk.maps.renderer.MapRenderer.(Unknown Source)
at com.mapbox.mapboxsdk.maps.renderer.glsurfaceview.GLSurfaceViewMapRenderer.(Unknown Source)
at com.mapbox.mapboxsdk.maps.MapView$5.(Unknown Source)
at com.mapbox.mapboxsdk.maps.MapView.initialiseDrawingSurface(Unknown Source)
at com.mapbox.mapboxsdk.maps.MapView.access$1000(Unknown Source)
at com.mapbox.mapboxsdk.maps.MapView$MapViewLayoutListener.onGlobalLayout(Unknown Source)
at android.view.ViewTreeObserver.dispatchOnGlobalLayout(ViewTreeObserver.java:912)
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2168)
at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1286)
at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:6551)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:871)
at android.view.Choreographer.doCallbacks(Choreographer.java:683)
at android.view.Choreographer.doFrame(Choreographer.java:619)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:857)
at android.os.Handler.handleCallback(Handler.java:751)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6312)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:872)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:762)

image

@tobrun tobrun added this to the android-v6.2.0 milestone May 24, 2018
@tobrun tobrun added the Android Mapbox Maps SDK for Android label May 24, 2018
@tobrun
Copy link
Member

tobrun commented May 24, 2018

@waar19 this is very strange as we haven't heard about any reports like this. Are you calling into Mapbox.getInstance(context, accessToken)? In any case, I'm removing the thrown exception in #12001 to resolve #4972 so this shouldn't be an issue moving forward. Any steps to reproduce this issue is highly appreciated, closing this issue as it is obsolete with changes from #12001.

@MohamedAbdelrazek
Copy link

I have the same Issue Here !!

@ActuallyGSM
Copy link

ActuallyGSM commented Dec 12, 2019

Set Mapbox.getInstance(this,getString(R.string.access_token)); method before the setContentView(R.layout.activity_map); Method. If you having this exception change code structure as follows.

i.e:

protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Mapbox.getInstance(this,getString(R.string.access_token));
setContentView(R.layout.activity_map);
mapView = (MapView) findViewById(R.id.mapView);
mapView.onCreate(savedInstanceState);
mapView.getMapAsync(mapboxMap -> mapboxMap.setStyle(
new Style.Builder().fromUrl(Style.MAPBOX_STREETS)
));
}

@mapbox mapbox deleted a comment from KaberereG Mar 20, 2020
@mapbox mapbox deleted a comment from ameerhamza6733 Mar 20, 2020
@jxian725
Copy link

I have the same issued and found out that you need to do
Mapbox.getInstance
first before
setContentView

It solved the problem

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Android Mapbox Maps SDK for Android needs information
Projects
None yet
Development

No branches or pull requests

5 participants