I'm using Mapbox's LocationLayerPlugin v0.6.0 with Proguard enabled.
In release builds, the location layer isn't requesting location updates: no GPS usage icon when in foreground, and the location becomes stale a few seconds after the first launch and never updates. I'm building the plugin without providing a LocationEngine, using public LocationLayerPlugin(MapView mapView, MapboxMap mapboxMap)
.
It doesn't happen in debug builds (no Proguard) or if I explicitly disable Proguard in the release build (minifyEnabled=false
). The proguard-rules.pro
file doesn't have any specific rules for Mapbox (both SDK and plugin), I've tried adding the ones from https://github.com/mapbox/mapbox-plugins-android/blob/master/app/proguard-rules.pro but the issue remains.
Are there other rules to be added? I couldn't find anything in the documentation.
If you are using google play location services, and the GoogleLocationEngine
, you can try adding
-keep class com.google.android.gms.** { *; }
-dontwarn com.google.android.gms.**
to your proguard-rules.pro
file.
I was able to reproduce the issue and above setup helped.
However, if you are only using the AndroidLocationEngine
there has been some issues with that engine recently, you can follow the issue tracker for more info.
For more context, if you will not manually add the google play location services dependency to your project, the LocationEngineProvider#obtainBestLocationEngineAvailable
used by the default constructor will return the AndroidLocationEngine
, otherwise, it will return the GoogleLocationEngine
.