Fix Android ProGuard View rules & release signing

- Enable ProGuard for the test app so the most common use case may be tested.
- Update ProGuard to keep all Mapbox views and their methods.
  Previously, ProGuard was stripping numerous class methods including
  UserLocationView.g/setAccuracy(). These particular methods are
  accessed via reflection. On newer APIs, this manifests only in Logcat
  and loss of functionality:

   PropertyValuesHolder  W  Method setAccuracy() with type float not found on target class class com.mapbox.mapboxsdk.views.UserLocationView
                         W  Method getAccuracy() with type null not found on target class class com.mapbox.mapboxsdk.views.UserLocationView

  On Android 4.03 and 4.04 (API 15), this causes an NPE:

    java.lang.NullPointerException
      at android.animation.PropertyValuesHolder.setupSetterAndGetter(PropertyValuesHolder.java:513)
      at android.animation.ObjectAnimator.initAnimation(ObjectAnimator.java:385)
      at android.animation.ValueAnimator.setCurrentPlayTime(ValueAnimator.java:537)
      at android.animation.ValueAnimator.start(ValueAnimator.java:927)
      at android.animation.ValueAnimator.start(ValueAnimator.java:950)
      at android.animation.ObjectAnimator.start(ObjectAnimator.java:363)
      at com.mapbox.mapboxsdk.views.UserLocationView.setLocation(UserLocationView.java:401)
      at com.mapbox.mapboxsdk.views.UserLocationView.toggleGps(UserLocationView.java:300)
      at com.mapbox.mapboxsdk.views.UserLocationView.setEnabled(UserLocationView.java:230)
      at com.mapbox.mapboxsdk.views.MapView.setMyLocationEnabled(MapView.java:3122)
      ...

  Also add Support libraries rules to the test. Further amendments may
  be made by examining usage.txt[0,1].

[0] http://developer.android.com/tools/help/proguard.html#enabling
[1] http://proguard.sourceforge.net/manual/usage.html#shrinkingoptions
This commit is contained in:
Stephen Niedzielski
2015-12-04 19:15:05 -07:00
committed by Tobrun
parent 37ca365469
commit 9747caa435
3 changed files with 5 additions and 8 deletions

View File

@@ -16,9 +16,4 @@
-keep class com.mapbox.mapboxsdk.http.** { *; }
# Package views
-keep class com.mapbox.mapboxsdk.views.MapView**
-keep class com.mapbox.mapboxsdk.views.NativeMapView**
-keepclassmembers class com.mapbox.mapboxsdk.views.NativeMapView** {
*;
}
-keep class com.mapbox.mapboxsdk.views.** { *; }

View File

@@ -69,7 +69,7 @@ android {
buildTypes {
release {
minifyEnabled false
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}

View File

@@ -1 +1,3 @@
# Proguard configuration is handeld in the SDK
# Mapbox ProGuard configuration is handled in the SDK
-keep class android.support.** { *; }