This preview has a new shared runtime. To ensure you are using it, you will need to delete the old shared runtime from your emulator/device:
Settings -> Applications -> Manage Applications -> MonoDroid Runtime -> Uninstall
The new runtime will be deployed to the device the next time an application is deployed.
Warning: Samsung shipped a broken kernel with Android 2.1, which is not able to support JIT compilation. If you possess a Galaxy-class device with Android 2.1, you will get unexpected results, this is caused by a kernel bug that breaks cache coherency, rendering any engine doing JIT compilation useless.
Bug Fixes / Enhancements
Activities no longer require proxies to facilitate mono runtime initialization, and no Mono Runtime service needs to be running in order to launch apps. This should speed up app startup.
The Android.App.ApplicationAttribute can be used to generate the
/manifest/application element within
AndroidManifest.xml. There are two ways it can be used:
- As an assembly-level custom attribute.
- On an Android.App.Application subclass.
There can be only one
ApplicationAttribute within an
Android.App.Application can be subclassed. If subclassed, and the type has the Android.App.ApplicationAttribute custom attribute, then a single instance of this type will be created during application startup and Android.Content.Context.ApplicationContext will return this instance.
Android.App.Application subclasses with the Android.App.ApplicationAttribute custom attribute mustprovide a constructor accepting a single IntPtr parameter, and must chain this constructor to the Android.App.Application(IntPtr) constructor.
Preview 5 introduced a model in which assemblies were named to match the
lib*.so glob, and placed into the
.apk. While this worked, it was deemed by many as a hack
(albeit an awesome one), and resulted in storing assemblies multiple times when
supporting multiple ABIs (as a set of assemblies would need to be stored in the
.apk for each ABI).
This changes in Preview 7. Assemblies are now stored uncompressed within the
.apk and loaded from
.apk during app startup. This has two immediately visible
- Application sizes will be larger. The "Hello, World" default template grows from 3.2MB to 12.8MB.
- The installed size be smaller . Assemblies compress well; in Preview 5, the application assemblies would still need to be extracted, so the extracted size ($APPDIR/lib contents + .apk) is 15.9MB, while in Preview 7 the extracted size is 12.9MB. Total size is thus reduced by 3MB.
Note that this size is not indicative of what apps will be by 1.0. Specifically, no linking is being done. Once the linker is integrated and running, we expect app sizes to shrink significantly.
Android.App.Activity subclasses no longer need a
(IntPtr) constructor, and must have a default constructor.
If no default constructor is present, then you will see a
NotImplementedException in the
adb logcat output with
the message: Unable to find the default constructor on type insert type here. Please provide the missing constructor.
The only types which require
(IntPtr) constructors are:
- Android.App.Application subclasses.
Types which subclass an Android type which invokes an overridden non-
finalmethod in the constructor; see IntPtr Constructor Invocation, below.
Application Package Must Be Lowercase
Properties\AndroidManifest.xml, the value of the
/manifest/@package attribute must be lowercase. Presence
of uppercase characters will result in build errors from monodroid.exe.
IntPtr Constructor Invocation
Usually, an (
IntPtr) constructor is not required. (This
has been true since Preview 3
except for Activities, which was fixed in this release.) There are two
situations where an (
IntPtr) constructor is required:
- When subclassing Android.App.Application .
- When subclassing an Android type (e.g. Android.Widget.TextView ) and overriding a virtual method which is invoked by the base class constructor (e.g. Android.Widget.TextView.DefaultMovementMethod ) and the type is created by Android (e.g. via an XML layout), e.g. LogTextBox.cs and logtextbox_1.xml .
You'll know you need an (
IntPtr) constructor when your app
crashes and you investigate the
The package names of Android Callable Wrappers generated by monodroid.exe are now lowercase instead of camelCase. This was done to sanely support case-insensitive filesystems.
In particular, developers should update their
Resources\layout\*.xml files so that all XML elements use lowercase
package names. See e.g. the changes done in ApiDemo\Resources\layout\logtextbox_1.xml.
- 633463 - Application crashes on startup when Assembly Name contains spaces.
- 645603 - MonoDroid doesn't support custom Application Classes
- 648893 - EditText.Text.ToString() doesn't give you the contents of the text field
- 648896 - KeyEventArgs.KeyCode should use Keycode enum instead of int
- 648898 - Missing feature constants in Window class
- 649456 - You can use java source files, but no R class is created, rendering it impossible to use layouts/resources/cocaine/etc.
- 649920 - Runtime producing UnsatisfiedLinkError on JavaObject hashCode calls
- 650335 - Keyboard shortcut does not work for SaveAll when code editor is active
- 650541 - Device emulator hangs if AndroidManifest package name contains space char at the end