Bug 30845 - Trying to Run a Droid Project on API 10
Summary: Trying to Run a Droid Project on API 10
Status: RESOLVED ANSWERED
Alias: None
Product: Android
Classification: Xamarin
Component: BCL Class Libraries ()
Version: 5.2
Hardware: PC Mac OS
: --- normal
Target Milestone: ---
Assignee: Jonathan Pryor
URL:
Depends on:
Blocks:
 
Reported: 2015-06-05 11:11 UTC by Andrew Page
Modified: 2015-06-05 14:39 UTC (History)
1 user (show)

Tags:
Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED ANSWERED

Description Andrew Page 2015-06-05 11:11:27 UTC
Java.Lang.RuntimeException: Unable to start activity ComponentInfo{com.aepage.localcards/md5611f112a0dcc620e2b1bdbfa1b51762e.MainActivity}: java.lang.ClassNotFoundException: android.animation.ValueAnimator in loader dalvik.system.PathClassLoader[/mnt/asec/com.aepage.prog-1/pkg.apk]
  at --- End of managed exception stack trace ---
  at java.lang.RuntimeException: Unable to start activity ComponentInfo{com.aepage.localcards/md5611f112a0dcc620e2b1bdbfa1b51762e.MainActivity}: java.lang.ClassNotFoundException: android.animation.ValueAnimator in loader dalvik.system.PathClassLoader[/mnt/asec/com.aepage.prog-1/pkg.apk]
  at at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1821)
  at at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1842)
  at at android.app.ActivityThread.access$1500(ActivityThread.java:132)
  at at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1038)
  at at android.os.Handler.dispatchMessage(Handler.java:99)
  at at android.os.Looper.loop(Looper.java:150)
  at at android.app.ActivityThread.main(ActivityThread.java:4263)
  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:839)
  at at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
  at at dalvik.system.NativeStart.main(Native Method)
  at Caused by: java.lang.ClassNotFoundException: android.animation.ValueAnimator in loader dalvik.system.PathClassLoader[/mnt/asec/com.aepage.localcards-1/pkg.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 at md5611f112a0dcc620e2b1bdbfa1b51762e.MainActivity.n_onCreate(Native Method)
  at at md5611f112a0dcc620e2b1bdbfa1b51762e.MainActivity.onCreate(MainActivity.java:28)
  at at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1072)
  at at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1785)
  at ... 11 more
Comment 1 Jonathan Pryor 2015-06-05 14:39:24 UTC
When running on a given version of Android, you must "somehow" ensure that all types and members that you use actually exist on that version of Android.

Case in point: android.animation.ValueAnimator was added in API-11, and thus CANNOT be used on an API-10 device:

http://developer.android.com/reference/android/animation/ValueAnimator.html

Based on the call stack, your MainActivity is attempting to use ValueAnimator, hence the crash. The ValueAnimator type can't be used. Or, it's use must be "guarded" by an API level check to ensure that the type exists on the target device:

https://github.com/xamarin/monodroid-samples/blob/95412c69/SanityTests/Hello.cs#L284-296