Notice (2018-05-24): bugzilla.xamarin.com is now in
Please join us on
Visual Studio Developer Community and in the
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
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.
I should be able to reference Build.VERSION_CODES.IceCreamSandwich regardless of whether I'm building for Froyo or ICS.
While it's easy enough to just use the raw int and cast it to the enum, it'd be far cleaner to just use the enum directly.
This is especially an issue because you have to compile at the lowest version of the OS that you support, otherwise certain classes are unusable (e.g. MotionEvent).
This is different from Java where you can compile with the most recent SDK, but can't use the newer APIs (e.g. InputEvent). The constants are compiled in, so it is safe to use them regardless of the OS.
It is totally doable with current MfA 4.2. MotionEvent issue is gone: http://docs.xamarin.com/android/Releases/Mono_For_Android_4/Mono_For_Android_4.2#Improved_API_level_support
I assume you already know this, but to achieve what you want - in the project properties, Set target Framework to 4.0.3 (API Level 15), and set Minimum Android Version as you want (e.g. API Level 4) in "Mono for Android Application" subpage (you'll have to "create" it first to set this version info). Unlike earlier versions it should just work on older platforms.