I want to use nineOldAndroid to my project. I have downloaded the project and import the library and works fine. Now I have add the library to my project but I have this error.
06-17 18:26:33.930: E/AndroidRuntime(1290): FATAL EXCEPTION: main
06-17 18:26:33.930: E/AndroidRuntime(1290): java.lang.NoClassDefFoundError: android.animation.ObjectAnimator
06-17 18:26:33.930: E/AndroidRuntime(1290): at my.package.es.MainFragment$1.onClick(MainFragment.java:105)
06-17 18:26:33.930: E/AndroidRuntime(1290): at android.view.View.performClick(View.java:2501)
06-17 18:26:33.930: E/AndroidRuntime(1290): at android.view.View$PerformClick.run(View.java:9107)
06-17 18:26:33.930: E/AndroidRuntime(1290): at android.os.Handler.handleCallback(Handler.java:587)
06-17 18:26:33.930: E/AndroidRuntime(1290): at android.os.Handler.dispatchMessage(Handler.java:92)
06-17 18:26:33.930: E/AndroidRuntime(1290): at android.os.Looper.loop(Looper.java:130)
06-17 18:26:33.930: E/AndroidRuntime(1290): at android.app.ActivityThread.main(ActivityThread.java:3835)
06-17 18:26:33.930: E/AndroidRuntime(1290): at java.lang.reflect.Method.invokeNative(Native Method)
06-17 18:26:33.930: E/AndroidRuntime(1290): at java.lang.reflect.Method.invoke(Method.java:507)
06-17 18:26:33.930: E/AndroidRuntime(1290): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:847)
06-17 18:26:33.930: E/AndroidRuntime(1290): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:605)
06-17 18:26:33.930: E/AndroidRuntime(1290): at dalvik.system.NativeStart.main(Native Method)
In the line of the error I have this code:
button_my.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
objectAnimator = ObjectAnimator.ofFloat(miscrol, "scrollY", 0, 480).setDuration(3000);
objectAnimator.start();
}
});
06-17 18:46:59.810: E/AndroidRuntime(1576): FATAL EXCEPTION: main
06-17 18:46:59.810: E/AndroidRuntime(1576): java.lang.StackOverflowError
06-17 18:46:59.810: E/AndroidRuntime(1576): at com.nineoldandroids.util.IntProperty.set(IntProperty.java:43)
06-17 18:46:59.810: E/AndroidRuntime(1576): at com.nineoldandroids.util.IntProperty.set(IntProperty.java:43)
06-17 18:46:59.810: E/AndroidRuntime(1576): at com.nineoldandroids.util.IntProperty.set(IntProperty.java:43)
and my code:
public void onClick(View v) {
ObjectAnimator objectAnimator= ObjectAnimator.ofInt(miscrol, "scrollY", 0, 480).setDuration(3000);
objectAnimator.start();
}
Check your imports.
You're using Android's ObjectAnimator
, which is not available for your API level. NineOldAndroids has its own (com.nineoldandroids.animation.ObjectAnimator
).