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.**
-keepclassmembers class com.google.android.gms.maps.model.Marker { *; }
. Can you update the answer, or should I instead keep my personal class that uses ObjectAnimator? – Ers