Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Progress amount doesn't work on Android 2.3 #9
We're develping an application for Android as minimum SDK 2.3.
System.TypeLoadException: Could not load type 'Android.Animation.ValueAnimator' from assembly 'Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=84e04ff9cfb79065'.
I know the animation is not avaliable when under API Level 11 (3.0), but shouldn't this animation only affect the smoothness of the component and not be used at all when the running SDK is 2.3?
I found another person having the same problem here
I would expect this code to work: https://github.com/Redth/AndHUD/blob/master/AndHUD/ProgressWheel.cs#L263-L281
Will have to do some debugging and see why that isn't the case...
Ok, I believe I know why you're having these issues:
So in every Xamarin.Android app you have 3 places where the version can be set (I need to write a blog post on this):
You generally usually want to set your Target framework (and therefore also Target Android version) to be the highest api level you are using API's from in your app. You can still specify and support running on lower API levels, you will just be making the compiler aware of the newest api levels you might use in your app.
For example, to use AndHUD you should set your Target Framework to a minimum of 3.0 Honeycomb (API Level 11). This is in fact, what AndHUD is targeting. If you don't target this level at least, the compiler has no knowledge of
This does not mean you can't still support older API levels. To support lower/older API levels you need to check the version at runtime and choose to only use API levels when the code is running on a device capable of it. This is where you see the logic used here: https://github.com/Redth/AndHUD/blob/master/AndHUD/ProgressWheel.cs#L263-L281
Now, you might be thinking, can't we use
TL;DR The short of it is that to use AndHUD's API's which take advantage of Animation (yet can gracefully fall back on API levels where it's not supported), you need to have a _Target Framework_ of API Level 11 or higher in your own application.
Hope that makes sense!
That's exactly what it was @Redth, thank you for taking the time to answer this and sorry for the long delay giving you a feedback.
All I had to do was to change the Target Framework to 3.1 (for some reason 3.0 wouldn't show up, even though it was installed) and everything worked as you explained in detail. My Minimum Android Version is still 2.3 (API 10).
If your main project is minimum 4.0, but target is set to use latest SDK is it safe to set AndHUD to use latest SDK also?