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]: ImageSource crashes on Android in release mode #3671

Open
matthieucan opened this issue Oct 28, 2024 · 0 comments
Open

[Bug]: ImageSource crashes on Android in release mode #3671

matthieucan opened this issue Oct 28, 2024 · 0 comments
Labels
bug 🪲 Something isn't working

Comments

@matthieucan
Copy link

Mapbox Implementation

Mapbox

Mapbox Version

11.4.1

React Native Version

0.75.1

Platform

Android

@rnmapbox/maps version

#main

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

Note that I did not fill the standalone component to reproduce, as it requires at least 1 external asset (an image).

When running a release version of Android, ImageSource crashes.
This is not the case for the debug mode, i.e. yarn start.

This can be reproduced in the example app within this repository:

cd example
(cd android && ./gradlew assembleRelease)
adb install ./android/app/build/outputs/apk/release/app-release.apk

Navigate to Fill/Raster Layer > Image Overlay.

The logs show:

10-29 00:17:51.528 17778 17778 E AndroidRuntime: FATAL EXCEPTION: main
10-29 00:17:51.528 17778 17778 E AndroidRuntime: Process: com.rnmapboxglexample, PID: 17778
10-29 00:17:51.528 17778 17778 E AndroidRuntime: java.lang.RuntimeException: ImageSource without URL not supported in v10, resourceId is not supported
10-29 00:17:51.528 17778 17778 E AndroidRuntime:        at com.rnmapbox.rnmbx.components.styles.sources.RNMBXImageSource.makeSource(RNMBXImageSource.kt:22)
10-29 00:17:51.528 17778 17778 E AndroidRuntime:        at com.rnmapbox.rnmbx.components.styles.sources.RNMBXImageSource.makeSource(RNMBXImageSource.kt:11)
10-29 00:17:51.528 17778 17778 E AndroidRuntime:        at com.rnmapbox.rnmbx.components.styles.sources.RNMBXSource.addToMap(RNMBXSource.kt:128)
10-29 00:17:51.528 17778 17778 E AndroidRuntime:        at com.rnmapbox.rnmbx.components.styles.sources.RNMBXSource$addToMap$2.onStyleLoaded(RNMBXSource.kt:151)
10-29 00:17:51.528 17778 17778 E AndroidRuntime:        at com.mapbox.maps.MapboxMap.getStyle(MapboxMap.kt:360)
10-29 00:17:51.528 17778 17778 E AndroidRuntime:        at com.rnmapbox.rnmbx.components.styles.sources.RNMBXSource.addToMap(RNMBXSource.kt:149)
10-29 00:17:51.528 17778 17778 E AndroidRuntime:        at com.rnmapbox.rnmbx.components.mapview.RNMBXMapView.addFeaturesToMap(RNMBXMapView.kt:520)
10-29 00:17:51.528 17778 17778 E AndroidRuntime:        at com.rnmapbox.rnmbx.components.mapview.RNMBXMapView.styleLoaded(RNMBXMapView.kt:287)
10-29 00:17:51.528 17778 17778 E AndroidRuntime:        at com.rnmapbox.rnmbx.components.mapview.RNMBXMapView.access$styleLoaded(RNMBXMapView.kt:203)
10-29 00:17:51.528 17778 17778 E AndroidRuntime:        at com.rnmapbox.rnmbx.components.mapview.RNMBXMapView$applyStyleURL$2.onStyleLoaded(RNMBXMapView.kt:673)
10-29 00:17:51.528 17778 17778 E AndroidRuntime:        at com.mapbox.maps.StyleObserver.onStyleLoaded(StyleObserver.kt:99)
10-29 00:17:51.528 17778 17778 E AndroidRuntime:        at com.mapbox.maps.NativeObserver.notify(NativeObserver.kt:63)
10-29 00:17:51.528 17778 17778 E AndroidRuntime:        at android.os.MessageQueue.nativePollOnce(Native Method)
10-29 00:17:51.528 17778 17778 E AndroidRuntime:        at android.os.MessageQueue.next(MessageQueue.java:339)
10-29 00:17:51.528 17778 17778 E AndroidRuntime:        at android.os.Looper.loopOnce(Looper.java:179)
10-29 00:17:51.528 17778 17778 E AndroidRuntime:        at android.os.Looper.loop(Looper.java:344)
10-29 00:17:51.528 17778 17778 E AndroidRuntime:        at android.app.ActivityThread.main(ActivityThread.java:8212)
10-29 00:17:51.528 17778 17778 E AndroidRuntime:        at java.lang.reflect.Method.invoke(Native Method)
10-29 00:17:51.528 17778 17778 E AndroidRuntime:        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:584)
10-29 00:17:51.528 17778 17778 E AndroidRuntime:        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1034)

Expected behavior

ImageSource works in both debug mode and release mode.

Notes / preliminary analysis

No response

Additional links and references

No response

@matthieucan matthieucan added the bug 🪲 Something isn't working label Oct 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🪲 Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant