mapbox / mapbox-gl-native

Interactive, thoroughly customizable maps in native Android, iOS, macOS, Node.js, and Qt applications, powered by vector tiles and OpenGL
https://mapbox.com/mobile
Other
4.37k stars 1.33k forks source link

nativePtr in MapRenderer is stripped by redex causing crash on release build #16546

Open gongz opened 3 years ago

gongz commented 3 years ago

Platform: mapbox-gl-native android Mapbox SDK version: n/a

Steps to trigger behavior

This is hard to debug because it only crashes on release with little trace to find the issue. Can you remove or annotate the unused field to reduce the risk of crashing the app on release? Thanks. like https://github.com/mapbox/mapbox-gl-native-android/blob/013076339111ae36862d474895588adec3795d24/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/http/NativeHttpRequest.java#L17-L18

  1. enable redex and generate release build
  2. init mapbox
  3. nativePtr will cause crash (mapbox-gl-native-android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/renderer/MapRenderer.java )

No pending exception expected: java.lang.NoSuchFieldError: no "J" field "nativePtr" in class "Lcom/mapbox/mapboxsdk/maps/renderer

Expected behavior

Actual behavior