React-native-mapbox-gl: IllegalArgumentException crash on Android

Created on 12 Mar 2018  路  37Comments  路  Source: nitaliano/react-native-mapbox-gl

Im seeing several following crashes on Google Play console.

java.lang.IllegalArgumentException: 
  at com.mapbox.mapboxsdk.maps.renderer.MapRenderer.onSurfaceChanged (MapRenderer.java:67)
  at com.mapbox.mapboxsdk.maps.renderer.textureview.TextureViewMapRenderer.onSurfaceChanged (TextureViewMapRenderer.java:48)
  at com.mapbox.mapboxsdk.maps.renderer.textureview.TextureViewRenderThread.run (TextureViewRenderThread.java:269)

react-native-mapbox-gl: 6.1.0
react-native: 0.52.2
device: android

high priority

Most helpful comment

` styleURL={MapboxGL.StyleURL.Street}
zoomLevel={this.state.mapZoomLevel}
centerCoordinate={[85.447828771, 27.716372043]}
style={{ height: 700, width: 700 }}
onLongPress={e => this.setState({ showBaseLocation: true })}

`

Giving some static height and width:

style={{ height: 700, width: 700 }}

I think this restricts fbHeight or fbWidth from being negative or greater than N amount of value
Might a temporary solution. However the map does take whole screen.

All 37 comments

This is our number one crash at the moment :(

@nitaliano do you have any ideas about this?

@nitaliano we are having tons of this crash 馃挘 Do you have an idea for this? 馃挕

Is there anymore information on this or do you know how to reproduce this?

This can only occur as part of the onSurfaceChanged callback. We haven't had reports of this issue upstream in gl-native. @hannta / @henrikra , do you see any additional error message to this IllegalArgumentException? eg. fbWidth cannot be negative. or fbWidth cannot be greater than 65535. I will create an issue upstream and link it back here, any additional information would be highly appreciated!

Yeah the logs say fbWidth cannot be negative

java.lang.IllegalArgumentException fbWidth cannot be negative. 
    MapRenderer.java:67 com.mapbox.mapboxsdk.maps.renderer.MapRenderer.onSurfaceChanged
    TextureViewMapRenderer.java:48 com.mapbox.mapboxsdk.maps.renderer.textureview.TextureViewMapRenderer.onSurfaceChanged
    TextureViewRenderThread.java:269 com.mapbox.mapboxsdk.maps.renderer.textureview.TextureViewRenderThread.run

Does this help you?

@henrikra yes it does, just for reference we opened an issue in gl-native as well https://github.com/mapbox/mapbox-gl-native/issues/11549

Any updates on this?

@kmagiera can you make a PR with that fix?

@nitaliano since we only have seen this crash occurring on react-native, I would prefer patching this up in this repo instead of on upstream. Thoughts?

@tobrun yes I agree with this, and I think we have a path forward for a patch

Still number one crash at the moment. Is somebody working on this who knows the codebase? :)

Here is a PR https://github.com/mapbox/react-native-mapbox-gl/pull/1171 with a potential fix, I cannot reproduce this issue, so if someone could test this out and let me know if this fixes their issue that would be great

@nitaliano @henrikra We're experiencing this issue widely as well. Is it worth making a new release with 6.1.2-beta? Will that fix the problem? Have not been able to reproduce the issue locally, have just indirectly seen this reported from our production application.

@nitaliano This should be open. We are still getting this

@henrikra did you give 6.1.2-beta a try?

@nitaliano Yeah we tried it in April and it was totally broken :/ Crashes and freezes. That version cannot be used in production

Some of our users also have this issue (20 out or 100 000 but it happens). HEre is the stacktrace:

java.lang.IllegalArgumentException: fbWidth cannot be negative.
    at com.mapbox.mapboxsdk.maps.renderer.MapRenderer.onSurfaceChanged(MapRenderer.java:67)
    at com.mapbox.mapboxsdk.maps.renderer.textureview.TextureViewMapRenderer.onSurfaceChanged(TextureViewMapRenderer.java:48)
    at com.mapbox.mapboxsdk.maps.renderer.textureview.TextureViewRenderThread.run(TextureViewRenderThread.java:269)

The last occurence is 4 days ago with the last stable version of the package. So I think the patch isn't really working. :confused:

Any updates for this issue?
I am also getting
java.lang.IllegalArgumentException: fbHeight cannot be greater than 65535. at com.mapbox.mapboxsdk.maps.renderer.MapRenderer.onSurfaceChanged(MapRenderer.java:80) at com.mapbox.mapboxsdk.maps.renderer.textureview.TextureViewMapRenderer.onSurfaceChanged(TextureViewMapRenderer.java:48) at com.mapbox.mapboxsdk.maps.renderer.textureview.TextureViewRenderThread.run(TextureViewRenderThread.java:269)
But this is only on Android. It works fine on iOS.

I got it resolved. I had it set to height='100%' earlier which made it grow in the height.
Now I am handling height of the container from the Android and setting height='100%' in the RN works.

@HarshalIndiJoshi Are you saying that you know how to reproduce this issue? What would the steps be in that case? Could you describe how you solved it in more detail? Thanks!

<TouchableOpacity style={{ width: '100%', height: 230 }} activeOpacity={1.0} > <Mapbox.MapView styleURL={Mapbox.StyleURL.Street} zoomLevel={10} centerCoordinate={[ Number(this.props.longitude), Number(this.props.latitude) ]} style={styles.container} zoomEnabled={false} pitchEnabled={false} scrollEnabled={false} rotateEnabled={false} showUserLocation={true}> </Mapbox.MapView> </TouchableOpacity>

If you look at the code then you will notice that height is given a specific value and not 100%.
I had seen the issue on android when I had set height:100%. In iOS integration height:100% worked but I guess it's not same case for Android.
I am new to android and react-native both. So please excuse me if I am giving any non-relevant information here.
Again, I am not saying that this is THE SOLUTION. But it WORKED FOR ME.
I can reproduce the issue by setting height:100%

This started happening in the latest release of our app. Among other things we updated react native (0.55.3 -> 0.56.0). The crash is most common with Android 8.0 users, but also affects 8.1, 7.0, 6.0. The release is on 6.1.1; we'll hopefully release a new version with 6.1.3 next week - crossing my fingers that the issue disappears.

Sorry: I'd like to take the comment above back - we HAVE seen this before, just with a different signature so the crashlogs showed up as new in Google Play Console. Here's to hoping that 6.1.3 resolves it for us.

@badrange Keep us in touch 馃

@badrange any news ? Just to know if I should update. Thanks :)

Release is a bit delayed, hoping that it goes out the door some time this week. I think you should update in any case! :-)

Update: We finally published the new version yesterday. So far we have received 26 crash reports - Android 6, 7, 8 and 8.1 - a range of phone models from Samsung, Motorola, Huawei and Nokia.

[email protected]
[email protected]

Im seeing pretty similar figures on our app, crashes on android... 馃槦

[email protected]
[email protected]

I get the same error..
"@mapbox/react-native-mapbox-gl": "^6.1.3"
"react-native": "0.57.0"

Reports Last 7 days: 1,072

Yes fix this issue fast. Still getting it

` styleURL={MapboxGL.StyleURL.Street}
zoomLevel={this.state.mapZoomLevel}
centerCoordinate={[85.447828771, 27.716372043]}
style={{ height: 700, width: 700 }}
onLongPress={e => this.setState({ showBaseLocation: true })}

`

Giving some static height and width:

style={{ height: 700, width: 700 }}

I think this restricts fbHeight or fbWidth from being negative or greater than N amount of value
Might a temporary solution. However the map does take whole screen.

<MapboxGL.MapView styleURL={MapboxGL.StyleURL.Street} zoomLevel={this.state.mapZoomLevel} centerCoordinate={[85.447828771, 27.716372043]} style={{ height: 700, width: 700 }} onLongPress={e => this.setState({ showBaseLocation: true })} >

I did something like this to fix that issue. Might a temporary solution. However the map does take whole screen.

<MapboxGL.MapView styleURL={MapboxGL.StyleURL.Street} zoomLevel={this.state.mapZoomLevel} centerCoordinate={[85.447828771, 27.716372043]} style={{ height: 700, width: 700 }} onLongPress={e => this.setState({ showBaseLocation: true })} >

I did something like this to fix that issue. Might a temporary solution. However the map does take whole screen.
Saved my A** buddy thanks a lot

          <MapboxGL.MapView
            style={{
              flex: 1,           <-- remove flex
              width: screenWidth,
              height: screenHeight
            }}
...
        </MapboxGL.MapView>

Is this still an issue? I am still experiencing this a crash on 6.1.3.

@drewg233 i think so.

It seems fixed for us with version 6.1.4 (master), this issue is not happening after updating the app.

image

Was this page helpful?
0 / 5 - 0 ratings

Related issues

glennverschooren picture glennverschooren  路  4Comments

EugenePisotsky picture EugenePisotsky  路  4Comments

smoll picture smoll  路  4Comments

Craytor picture Craytor  路  3Comments

VentsislavDinev picture VentsislavDinev  路  3Comments