androidandroid-fragmentsnineoldandroids

NineOldAndroids: why I'm getting NoClassDefFound about ObjectAnimator?


Disclaimer :

I imported correctly the NineOldAndroids as a project also added it correctly to the build -ath of my project.

Finally I imported the ObjectAnimator and the other packages correctly from com.nineoldandroids.animation.

My goal is to perform an animation between two fragments using NineOldAndroids. I was just testing the example, but I think I'm missing something: when I istantiate the ValueAnimator object (as suggested at nineoldandroids.com/), in runtime I get a NoClassDefFoundError.

ValueAnimator colorAnim = ObjectAnimator.ofInt(mainFragment, "backgroundColor", 0xFFFF808, 0xFF8080FF);
colorAnim.setDuration(3000);
colorAnim.setRepeatCount(ValueAnimator.INFINITE);
colorAnim.setRepeatMode(ValueAnimator.REVERSE);
colorAnim.start();

I just copy-pasted the example, applied it on a Fragment and I'm getting this, in runtime:

06-17 10:20:00.352: E/AndroidRuntime(16548): FATAL EXCEPTION: main 
06-17 10:20:00.352: E/AndroidRuntime(16548): Process: enricopezzini.loginnner, PID: 16548
06-17 10:20:00.352: E/AndroidRuntime(16548): java.lang.NoClassDefFoundError: com.nineoldandroids.animation.ObjectAnimator
06-17 10:20:00.352: E/AndroidRuntime(16548):    at enricopezzini.loginnner.MainActivity.onLoginSuccess(MainActivity.java:59)
06-17 10:20:00.352: E/AndroidRuntime(16548):    at enricopezzini.loginnner.fragments.AuthenticationFragment$1.success(AuthenticationFragment.java:87)
06-17 10:20:00.352: E/AndroidRuntime(16548):    at enricopezzini.loginnner.fragments.AuthenticationFragment$SignIn.onPostExecute(AuthenticationFragment.java:237)
06-17 10:20:00.352: E/AndroidRuntime(16548):    at enricopezzini.loginnner.fragments.AuthenticationFragment$SignIn.onPostExecute(AuthenticationFragment.java:1)
06-17 10:20:00.352: E/AndroidRuntime(16548):    at android.os.AsyncTask.finish(AsyncTask.java:632)
06-17 10:20:00.352: E/AndroidRuntime(16548):    at android.os.AsyncTask.access$600(AsyncTask.java:177)
06-17 10:20:00.352: E/AndroidRuntime(16548):    at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:645)
06-17 10:20:00.352: E/AndroidRuntime(16548):    at android.os.Handler.dispatchMessage(Handler.java:102)
06-17 10:20:00.352: E/AndroidRuntime(16548):    at android.os.Looper.loop(Looper.java:136)
06-17 10:20:00.352: E/AndroidRuntime(16548):    at android.app.ActivityThread.main(ActivityThread.java:5001)
06-17 10:20:00.352: E/AndroidRuntime(16548):    at java.lang.reflect.Method.invokeNative(Native Method)
06-17 10:20:00.352: E/AndroidRuntime(16548):    at java.lang.reflect.Method.invoke(Method.java:515)
06-17 10:20:00.352: E/AndroidRuntime(16548):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785)
06-17 10:20:00.352: E/AndroidRuntime(16548):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
06-17 10:20:00.352: E/AndroidRuntime(16548):    at dalvik.system.NativeStart.main(Native Method)

How can I solve this?

Thanks for the attention.


Solution

  • Check correctly whether you has added it to build path.

    Android project >> properties >> java build path ... check there please