Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Crash on android when open app and initialising the MapView #3016

Closed
LuannguyenAxonActive opened this issue Aug 28, 2023 · 1 comment
Labels
Android Android related tickets upstream the bug source is a bug in native mapbox gl

Comments

@LuannguyenAxonActive
Copy link

Mapbox Implementation

Mapbox

Mapbox Version

10.13.1

Platform

Android

@rnmapbox/maps version

10.0.8

Standalone component to reproduce

import React from 'react';
import {
  MapView,
  ShapeSource,
  LineLayer,
  Camera,
} from '@rnmapbox/maps';

const aLine = {
  type: 'LineString',
  coordinates: [
    [-74.00597, 40.71427],
    [-74.00697, 40.71527],
  ],
};

class BugReportExample extends React.Component {
  render() {
    return (
      <MapView style={{flex: 1}}>
        <Camera centerCoordinate={[-74.00597, 40.71427]} zoomLevel={14} />
        <ShapeSource id="idStreetLayer" shape={aLine}>
          <LineLayer id="idStreetLayer" />
        </ShapeSource>
      </MapView>
    );
  }
}

Observed behavior and steps to reproduce

Caused by com.mapbox.maps.MapboxConfigurationException
Using MapView requires providing a valid access token when inflating or creating the view. Provide the token by either: 1. Initialising the MapView programmatically using 'MapInitOptions' and configure the token using 'MapInitOptions.resourceOptions.accessToken'. 2. Or by passing it using MapView's 'mapbox_resourcesAccessToken' XML attribute. 3. Or by creating a mapbox_access_token string resource. The access token parameter is required when using a Mapbox service. 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.

Caused by com.mapbox.maps.MapboxConfigurationException: Using MapView requires providing a valid access token when inflating or creating the view.
Provide the token by either:
  1. Initialising the MapView programmatically using 'MapInitOptions' and configure the token using 'MapInitOptions.resourceOptions.accessToken'.
  2. Or by passing it using MapView's 'mapbox_resourcesAccessToken' XML attribute.
  3. Or by creating a mapbox_access_token string resource.
The access token parameter is required when using a Mapbox service.
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.maps.ResourceOptionsManager$Companion.getDefault(ResourceOptionsManager.kt:71)
       at com.mapbox.maps.ResourceOptionsManager$Companion.getDefault$default(ResourceOptionsManager.kt:50)
       at com.mapbox.maps.MapInitOptions$Companion.getDefaultResourceOptions(MapInitOptions.kt:47)
       at com.mapbox.maps.MapInitOptions.<init>(MapInitOptions.kt:28)
       at com.mapbox.maps.MapView.<init>(MapView.kt:57)
       at com.mapbox.rctmgl.components.mapview.RCTMGLMapView.<init>(RCTMGLMapView.kt:1094)
       at com.mapbox.rctmgl.components.mapview.RCTMGLMapViewManager.createViewInstance(RCTMGLMapViewManager.kt:88)
       at com.mapbox.rctmgl.components.mapview.RCTMGLMapViewManager.createViewInstance(RCTMGLMapViewManager.kt:43)
       at com.facebook.react.uimanager.ViewManager.createViewInstance(ViewManager.java:139)
       at com.facebook.react.uimanager.ViewManager.createView(ViewManager.java:76)
       at com.facebook.react.uimanager.NativeViewHierarchyManager.createView(NativeViewHierarchyManager.java:281)
       at com.facebook.react.uimanager.UIViewOperationQueue$CreateViewOperation.execute(UIViewOperationQueue.java:194)
       at com.facebook.react.uimanager.UIViewOperationQueue$1.run(UIViewOperationQueue.java:909)
       at com.facebook.react.uimanager.UIViewOperationQueue.flushPendingBatches(UIViewOperationQueue.java:1026)
       at com.facebook.react.uimanager.UIViewOperationQueue.pauseFrameCallback(UIViewOperationQueue.java:1003)
       at com.facebook.react.uimanager.UIImplementation.onHostPause(UIImplementation.java:783)
       at com.facebook.react.uimanager.UIManagerModule.onHostPause(UIManagerModule.java:222)
       at com.facebook.react.bridge.ReactContext.onHostPause(ReactContext.java:290)
       at com.facebook.react.ReactInstanceManager.moveToBeforeResumeLifecycleState(ReactInstanceManager.java:797)
       at com.facebook.react.ReactInstanceManager.onHostPause(ReactInstanceManager.java:586)
       at com.facebook.react.ReactInstanceManager.onHostPause(ReactInstanceManager.java:612)
       at com.facebook.react.ReactDelegate.onHostPause(ReactDelegate.java:63)
       at com.facebook.react.ReactActivityDelegate.onPause(ReactActivityDelegate.java:96)
       at com.facebook.react.ReactActivity.onPause(ReactActivity.java:52)
       at android.app.Activity.performPause(Activity.java:8778)
       at android.app.Instrumentation.callActivityOnPause(Instrumentation.java:1585)
       at android.app.ActivityThread.performPauseActivityIfNeeded(ActivityThread.java:5707)
       at android.app.ActivityThread.performPauseActivity(ActivityThread.java:5668)
       at android.app.ActivityThread.handlePauseActivity(ActivityThread.java:5620)
       at android.app.servertransaction.PauseActivityItem.execute(PauseActivityItem.java:47)
       at android.app.servertransaction.ActivityTransactionItem.execute(ActivityTransactionItem.java:45)
       at android.app.servertransaction.TransactionExecutor.executeLifecycleState(TransactionExecutor.java:176)
       at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:97)
       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2574)
       at android.os.Handler.dispatchMessage(Handler.java:106)
       at android.os.Looper.loopOnce(Looper.java:226)
       at android.os.Looper.loop(Looper.java:313)
       at android.app.ActivityThread.main(ActivityThread.java:8757)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:571)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1067)

Expected behavior

No response

Notes / preliminary analysis

It was just reported on our Firebase crash analytics, Seems just happens abnormally on some Samsung devices (Galaxy A53 5G, Galaxy S10e, Galaxy A13 5G), other devices still work with the same implementation. I'm not sure about the chip of these devices.

Additional links and references

No response

@LuannguyenAxonActive LuannguyenAxonActive changed the title [Bug]: [Bug]: Crash on android when open app and initialising the MapView Aug 28, 2023
@mfazekas mfazekas added upstream the bug source is a bug in native mapbox gl Android Android related tickets labels Aug 29, 2023
@mfazekas
Copy link
Contributor

@LuannguyenAxonActive sorry not much we can do about that. If you're sure that the passed access token is ok, then it's an upstream issue with the libraries we use Mapbox-maps-android. I'm closing as there is not much we can do about it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Android Android related tickets upstream the bug source is a bug in native mapbox gl
Projects
None yet
Development

No branches or pull requests

2 participants