mapbox / mapbox/mapbox-maps-android

Crash when code obfuscated with R8/proguard/dexguard

Open
#2,665 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug :beetle: needs info
Dominant language
Kotlin
Stars
578
Forks
161
PR merge metrics
No merged PRs in 30d

Description

Environment

  • Android OS version: 35
  • Devices affected: samsung SM-X700
  • Maps SDK for Android Version: 11.14.0

Observed behavior and steps to reproduce

  1. Build compose-app in this repo in release mode
  2. Make sure it applied all the rules defined under project
  3. Launch any activity that contain @Composable MapboxMap using MapViewportState, crash happen

Caused by: com.mapbox.common.MapboxInitializerException: Failed to initialize: Attempt=2, exception=[pushOffsetToPath], initializer called 35333 ms ago, exception.message=[o.pushOffsetToPath: o.pushOffsetToPath: MapboxInvalidModuleException(type=CommonLibraryLoader)], exception.cause=[pushOffsetToPath], exception.cause.message=[o.pushOffsetToPath: MapboxInvalidModuleException(type=CommonLibraryLoader)], extractedNativeLibs=[], isInstantApp=[false], isMainThread=[true]
at com.mapbox.common.BaseMapboxInitializer$Companion.void init(java.lang.Class,boolean)(BaseMapboxInitializer.java:418)
at com.mapbox.common.BaseMapboxInitializer$Companion.void init(java.lang.Class)(BaseMapboxInitializer.java:114)
at com.mapbox.common.BaseMapboxInitializer.void init(java.lang.Class)(BaseMapboxInitializer.java:65353)
at com.mapbox.maps.CameraOptions.void ()(CameraOptions.java:223)
... 41 more
Caused by: androidx.startup.StartupException: o.pushOffsetToPath: o.pushOffsetToPath: MapboxInvalidModuleException(type=CommonLibraryLoader)
at androidx.startup.AppInitializer.java.lang.Object doInitialize(java.lang.Class,java.util.Set)(AppInitializer.java:187)
at androidx.startup.AppInitializer.java.lang.Object doInitialize(java.lang.Class)(AppInitializer.java:138)
at androidx.startup.AppInitializer.java.lang.Object initializeComponent(java.lang.Class)(AppInitializer.java:117)
at com.mapbox.common.BaseMapboxInitializer$Companion.void init(java.lang.Class,boolean)(BaseMapboxInitializer.java:242)
... 44 more

Expected behavior

App shouldn't crash when code is optimized and obfuscated with tool like proguard/dexguard

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Build the compose-app in release mode with the project’s existing optimization rules, then launch an activity containing @Composable MapboxMap with MapViewportState. Start with the MapboxInitializerException and MapboxInvalidModuleException stack trace; done means the optimized, obfuscated app launches without this initialization crash.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, kotlin
Domain
mobile
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.