[Bug]: ImageSource crashes on Android in release mode
Nobody has claimed this yet.
- Dominant language
- Kotlin
- Stars
- 2.9k
- Forks
- 947
- Avg merge
- 6d 37m
- Merged PRs (30d)
- 1
Description
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
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with RNMBXImageSource.kt at makeSource line 22 and reproduce the failure by building the example app with ./gradlew assembleRelease. Navigate to Fill/Raster Layer > Image Overlay and compare release behavior with debug mode. Done means ImageSource works without crashing in both modes.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- android, kotlin, react-native
- Domain
- mobile
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 48/100