Java.Lang.NoClassDefFoundError after executing a blank Xamarin.Forms Android project

When creating a new Xamarin.Forms Shared app and execute the Android app, it will throw me a Java.Lang.NoClassDefFoundError at MainActivity#OnCreate:22. The exception details specify android.animation.ValueAnimator as the source and the following exception trace:

Java.Lang.NoClassDefFoundError: android.animation.ValueAnimator
at Android.Runtime.JNIEnv.FindClass (string) [0x00087] in /Users/builder/data/lanes/monodroid-mlion-monodroid-4.12-series/41933531/source/monodroid/src/Mono.Android/src/Runtime/JNIEnv.cs:396
at Android.Runtime.JNIEnv.FindClass (string,intptr&) [0x00014] in /Users/builder/data/lanes/monodroid-mlion-monodroid-4.12-series/41933531/source/monodroid/src/Mono.Android/src/Runtime/JNIEnv.cs:409
at Android.Animation.ValueAnimator.get_class_ref () [0x00000] in /Users/builder/data/lanes/monodroid-mlion-monodroid-4.12-series/41933531/source/monodroid/src/Mono.Android/platforms/android-15/src/generated/Android.Animation.ValueAnimator.cs:147
at Android.Animation.ValueAnimator..ctor () [0x00084] in /Users/builder/data/lanes/monodroid-mlion-monodroid-4.12-series/41933531/source/monodroid/src/Mono.Android/platforms/android-15/src/generated/Android.Animation.ValueAnimator.cs:178
at at Xamarin.Forms.Platform.Android.AndroidTicker..ctor () <IL 0x00009, 0x0008f>
at at Xamarin.Forms.Forms.Init (Android.App.Activity,Android.OS.Bundle) <IL 0x00087, 0x00503>
at TestProject.Android.MainActivity.OnCreate (Android.OS.Bundle) [0x00009] in c:\Users\jeroen\Documents\Projects\TestProject\Android\MainActivity.cs:22
at Android.App.Activity.n_OnCreate_Landroid_os_Bundle_ (intptr,intptr,intptr) [0x00011] in /Users/builder/data/lanes/monodroid-mlion-monodroid-4.12-series/41933531/source/monodroid/src/Mono.Android/platforms/android-15/src/generated/Android.App.Activity.cs:1943
at at (wrapper dynamic-method) object.62039a7e-6730-4dd0-91b9-db0d873378d4 (intptr,intptr,intptr) <IL 0x00017, 0x00043>
at --- End of managed exception stack trace ---
at java.lang.NoClassDefFoundError: android.animation.ValueAnimator
at at testproject.android.MainActivity.n_onCreate(Native Method)
at at testproject.android.MainActivity.onCreate(MainActivity.java:28)
at at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
at at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1615)
at at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1667)
at at android.app.ActivityThread.access$1500(ActivityThread.java:117)
at at android.app.ActivityThread$H.handleMessage(ActivityThread.java:935)
at at android.os.Handler.dispatchMessage(Handler.java:99)
at at android.os.Looper.loop(Looper.java:130)
at at android.app.ActivityThread.main(ActivityThread.java:3687)
at at java.lang.reflect.Method.invokeNative(Native Method)
at at java.lang.reflect.Method.invoke(Method.java:507)
at at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:867)
at at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:625)
at at dalvik.system.NativeStart.main(Native Method)
at Caused by: java.lang.ClassNotFoundException: android.animation.ValueAnimator in loader dalvik.system.PathClassLoader[/data/app/TestProject.Android-1.apk]
at at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:240)
at at java.lang.ClassLoader.loadClass(ClassLoader.java:551)
at at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
at ... 15 more

This happens both in Xamarin Studio and Visual Studio and occurs both when I use and emulator and a physical device.

I have used API 10 at the emulators and my phone. SDK platforms L, 20, 19, 15, 12 and 10 are installed additonally to the Android Support Library, Google USB Driver, Android SDK tools, Android SDK Platform-Tools and Android SDK Build-Tools 20 & 17.

What could cause this?

Posts

  • jeroenvanneveljeroenvannevel BEMember

    Since I can't edit my post I'll add it here: this only occurs at Xamarin.Forms projects (both a Portable and a Shared app), a classic Android app runs just fine.

  • jeroenvanneveljeroenvannevel BEMember

    I figured I'd update this: it was a matter of phone. I switched my Samsung Galaxy Gio GTS-5660 for a Motorola Moto G and now everything works flawlessly.

Sign In or Register to comment.