0

I created a private static inner class ViewWrapper with methods getHeight() and setHeight(int), and it's used as the target for ValueAnimator. But in Android 4.0 I got NoSuchMethodException which caused the exception. It's really appreciated if anyone has any idea about it and can help me.

    PropertyValuesHolder: Can't find native method using JNI, use reflectionjava.lang.NoSuchMethodError: no method with name='setHeight' signature='(I)V' in class Lvc$a;
    PropertyValuesHolder: Couldn't find setter/getter for property height with value type int
    PropertyValuesHolder: Couldn't find no-arg method for property height: java.lang.NoSuchMethodException: getHeight []

    java.lang.NullPointerException
    at android.animation.PropertyValuesHolder.setupSetterAndGetter(PropertyValuesHolder.java:513)
    at android.animation.ObjectAnimator.initAnimation(ObjectAnimator.java:392)
    at android.animation.ValueAnimator.startAnimation(ValueAnimator.java:1052)
    at android.animation.ValueAnimator.access$400(ValueAnimator.java:49)
    at android.animation.ValueAnimator$AnimationHandler.handleMessage(ValueAnimator.java:616)
    at android.os.Handler.dispatchMessage(Handler.java:99)
    at android.os.Looper.loop(Looper.java:137)
    at android.app.ActivityThread.main(ActivityThread.java:4424)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:511)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
    at dalvik.system.NativeStart.main(Native Method)

private static class ViewWrapper {
    private View mTarget;

    public ViewWrapper(View target) {
        mTarget = target;
    }

    public int getWidth() {
        return mTarget.getLayoutParams().width;
    }

    public void setWidth(int width) {
        mTarget.getLayoutParams().width = width;
        mTarget.requestLayout();
    }

    public int getHeight(){
        return mTarget.getLayoutParams().height;
    }

    public void setHeight(int height) {
        mTarget.getLayoutParams().height = height;
        mTarget.requestLayout();
    }
}
  • See if this helps you: http://stackoverflow.com/questions/17563973/propertyvaluesholder-couldnt-find-setter-getter-for-property-property-name-w – yakobom Mar 06 '17 at 08:21
  • I'm afraid not. I post my code of the target Object up there. It's certain that there is a getHeight() method there. @yakobom – Ivan Aldrich Mar 06 '17 at 09:58

0 Answers0