I am animating a Map Marker via the following code:
final Property<Marker, LatLng> property =
Property.of(Marker.class, LatLng.class, "position");
final ObjectAnimator animator =
ObjectAnimator.ofObject(otherMarker, property, typeEvaluator, toLatLng);
This works fine in a debug build but fails with the following stack trace in a signed build:
0
android.util.NoSuchPropertyException: No accessor method or field found for property with name position
1
at android.util.ReflectiveProperty.<init>(ReflectiveProperty.java:71)
2
at android.util.Property.of(Property.java:55)
3
at com.myapp.fragment.MapWrapperFragment.j(MapWrapperFragment.java:1090)
4
at com.myapp.ActivityA.l(ActivityA.java:860)
5
at com.myapp.fragment.FragmentA$22.onClick(FragmentA.java:377)
6
at android.view.View.performClick(View.java:4438)
7
at android.view.View$PerformClick.run(View.java:18422)
8
at android.os.Handler.handleCallback(Handler.java:733)
9
at android.os.Handler.dispatchMessage(Handler.java:95)
10
at android.os.Looper.loop(Looper.java:136)
11
at android.app.ActivityThread.main(ActivityThread.java:5001)
12
at java.lang.reflect.Method.invokeNative(Native Method)
13
at java.lang.reflect.Method.invoke(Method.java:515)
14
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785)
15
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
16
at dalvik.system.NativeStart.main(Native Method)
What could be the reason for this? I am not sure if it's relevant, but I am using Proguard.
I stumbled across the same issue but the provided proguard changes did not do it for me. I guess because I use the new play services ('com.google.android.gms:play-services-maps:7.0.0') and they probably have a different internal structure
What worked for me was:
-keep class com.google.android.gms.** { *; }
Proguard is either removing or renaming the field, since it doesn't know about any access done via reflection. That's why it fails at runtime.
You should probably add a -keep
(or -keepnames
) rule to prevent this.
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