I am using NineOldAndroids' ObjectAnimators to fade in Android Map v2 markers with the following code:
mMarkerSelected = mMap.addMarker(new MarkerOptions()
.position(location.getLatLng())
.title(location.getName())
.snippet(location.getId())
.icon(BitmapDescriptorFactory.defaultMarker(location.getMarkerHue())));
mMarkerSelected.setAlpha(0.0f);
ObjectAnimator.ofFloat(mMarkerSelected, "alpha", 0.0f, 1.f)
.setDuration(300).start();
This works perfectly with debuggable versions of the apk.
However, when I sign my apk and use ProGuard, suddenly marker doesn't fade in. My guess is that the alpha attribute has been obfuscated so that passing "alpha"
into ObjectAnimator.ofFloat
doesn't match up with the obfuscated alpha attribute of the Marker
. How can I get the animation to work when using ProGuard?
Just for completeness, this is the only contents of my proguard-rules.txt
-dontwarn com.squareup.okhttp.**
It uses reflection so you need your method names intact i.e. setAlpha(), something like this in your proguard config:
# This is due to ObjectAnimator using reflection to access get/sets
-keep class com.your.package.ClassThatUsesObjectAnimator { *; }
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