I am developing an app that uses google maps. The app works fine up until I Export the signed app package .After the code has been obfuscated the maps are no longer loaded. I am pretty new to ProGuard,I've tried modifying proguard.cfg but soo far nothing has worked. Here are some of the different things that i've tried:
-libraryjars C:/Program Files/Android/android-sdk/add-ons/addon-google_apis-google_inc_-10/libs/maps.jar
-keep class android.location.** { *; }
-keepnames class com.google.android.maps.** {*;}
-keep public class com.google.android.maps.** {*;}
-dontwarn com.google.android.maps.GeoPoint
-dontwarn com.google.android.maps.MapActivity
-dontwarn com.google.android.maps.MapView
-dontwarn com.google.android.maps.MapController
-dontwarn com.google.android.maps.Overlay
Thanks
In the obfuscation step, ProGuard renames classes and class members that are not entry points. In this entire process, keeping the entry points ensures that they can still be accessed by their original names. The preverification step is the only step that doesn't have to know the entry points.
By default, ProGuard obfuscates the code: it assigns new short random names to classes and class members. It removes internal attributes that are only useful for debugging, such as source files names, variable names, and line numbers.
If your code works fine without the missing classes, you can suppress the warnings with '-dontwarn' options. (
Edit: For Google Maps For Android V2 Specifically:
Just in case anyone sees this and has a similar issue - I was getting a Parcelable
RuntimeException
when I tried to view a second map (as in, Activity A
had a map instance, then moving to Activity B
, another instance with different params), pointing to what i was assuming was an obfuscated class name in the google package.
after i added
-keep class com.google.android.gms.maps.** { *; }
-keep interface com.google.android.gms.maps.** { *; }
to my proguard-project.txt everything seemed to keep working as normal
It is most likely issue with the Maps API Key. You should generate the Key with the signature used while exporting the app and use it in your map view.
Its unlikely that Obfuscation using ProGuard will affect the map rendering.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With