Stable release: Xamarin.Android 5.1.0, breaking changes, new features and bug fixes RRS feed

  • Question

  • User13824 posted

    Released versions:



    Reason for release: New features and bug fixes.

    Release notes: http://developer.xamarin.com/releases/android/xamarin.android_5/xamarin.android_5.1/

    Date published:

    NOTE: This feature release includes a significant number of changes. There are several breaking changes as well as several known issues (see below) compared to the previous Stable versions. Many of the known issues have been addressed in the follow-up "service release" currently available on the Beta and Alpha channels.

    Previous versions, downgrading

    You can downgrade back to the previous Stable version by manually reinstalling each Stable package (see also the article about downgrading). The links to the previous Stable versions are:



    Guidelines for this thread

    1. This first post will be updated regularly.

    2. Hopefully this thread will help answer "what might break if I update to this release?"

    3. If you find a new problem that is specific to this version, please file a bug report (if this link redirects to the top-level https://kb.xamarin.com/ page the first time you click it, try clicking it once more).

    4. Please discuss older bugs that are unchanged in this release compared to the previous Stable version in Bugzilla instead.

    5. Of course for questions and discussions about topics other than bugs, feel free start new forum threads.

    Android breaking changes

    Important: Xamarin.Android 5.1 contains several breaking changes that will require corresponding code changes in your projects. These changes also alter the way unhandled exceptions behave in the debugger.

    See: http://developer.xamarin.com/releases/android/xamarin.android_5/xamarin.android_5.1/#Breaking_Changes

    • One change that is likely to require corresponding changes in your projects is that the "name mangling scheme for Android Callable Wrappers" has been modified. This means that the generated Java type names for C# classes are different. So for example you will now need to add explicit [Register] attributes on any C# classes that you want to reference using the view class= syntax in AXML files. If you only use the "XML element name" syntax in your AXML files (see "Use the Custom Component" in the docs), then you will not need to add [Register] attributes.

    • Related Bug 29263 - Classes that are referenced by files in the "Resources/xml/" folder will currently all need [Register] attributes, even if the "XML element name" syntax is used. The fix for this inconsistency is available in the current Alpha channel builds.

    • Due to the new Cross-VM Exception Propagation in Xamarin.Android 5.1, unhandled C# exceptions will by default not break on the original C# exception. They will instead break on a Java.Lang.RuntimeException, and the C# local variables will not be available at any position within the call stack. To access the local variables, you can do one of the following:

      • Set the IDE to break on all exceptions. This will allow the debugger to break on the original C# exception, but it also means the debugger will break on all other exceptions of the same type, even if they are handled.

      • Temporarily disable the new exception propagation by setting the XA_BROKEN_EXCEPTION_TRANSITIONS environment variable to true.

    • Xamarin.Android Java bindings projects built using Xamarin.Android 5.1 are not backwards-compatible with Xamarin.Android 4.20 due to use of the new JValue* JNI method arguments. Attempting to use the libraries on 4.20 will result in a build error:

      Reference to metadata item '... Android.Runtime.JValue* ...' ... could not be resolved.

    Xamarin Studio new publishing workflow

    Important: Xamarin Studio 5.9 uses a new workflow to create final Android, iOS, and Mac apps for publication. The old menu items for creating publishable APKs, iOS archives, and iOS .ipa files have been removed.

    See: http://developer.xamarin.com/releases/studio/xamarin.studio_5.9/xamarin.studio_5.9/#Publishing_Workflow

    New known issues compared to the previous stable versions, with more common or severe issues near the top

    • Bug 29133 - [XamarinVS] [iOS] [Android] Visual Studio hangs when debugging some iOS and Android applications that use multiple threads. Now fixed in the Alpha and Beta channels.

    • Bug 29570 - [Android] Greater-than and less-than comparisons of decimal numbers do not work correctly. Now fixed in the latest Stable, Alpha, and Beta channels.

    • Bug 29680 - [XamarinVS] [iOS] [Android] Ignorable "ERROR: Not implemented (Exception from HRESULT: 0x80004001 (E_NOTIMPL))" message from the new Test Cloud integration. Now fixed in the Beta and Alpha channels. (Old partial workaround**: uninstall the Test Cloud integration: https://bugzilla.xamarin.com/show_bug.cgi?id=29680#c2.)

    • Bug 29220 - [XamarinVS] [iOS] [Android] "ERROR: Value cannot be null. Parameter name: project" when opening and building projects. So far, this problem appears to be related to specifics of the system configuration. If anyone happens to notice one particular difference between a working project and a failing project (or a computer without the problem and a computer with the problem), be sure to let us know right away. Now fixed in the Beta and Alpha channels. (Old partial workaround: uninstall the Test Cloud integration: https://bugzilla.xamarin.com/show_bug.cgi?id=29680#c2.)

    • Bug 29568 - [Android] "No resource found that matches the given name", for AppCompat resources in the Android Support library. Now fixed in the Alpha and Beta channels.

    • Non-public Bug 29172 - [Android] "'...Resource' does not contain a definition for `Id'" (for example, when using the Scandit component). Now fixed in the Alpha and Beta channels.

    • Non-public Bug 28995 - [Android] On certain devices, certain apps crash frequently due to "System.ExecutionEngineException: SIGILL".

    • Bug 30171 - [Mono] [iOS] [Android] BinaryReader.ReadChar() returns incorrect result. Now fixed in the Beta and Alpha channels.

    • Bug 29730 - [Android] Event handlers subscribed to (some?) events that are bound to Java callbacks no longer work (for example ViewTreeObserver.GlobalLayout). Now fixed in the Alpha and Beta channels. (Old workaround: use the corresponding "Add/Remove...Listener" methods instead: https://bugzilla.xamarin.com/show_bug.cgi?id=29730#c2.)

    • Bug 30318 - [Android] Windows only: Breakpoints in PCL projects do not work after cleaning solution, redeploying, and restarting debugging. Partial workaround: delete all the bin folders in the solution after cleaning.

    • Bug 30371 - [Visual Studio] [Android] Project Properties display incorrect default values for "BundleAssemblies" and "EmbedAssembliesIntoApk" if they are not explicitly specified. This means that these properties can "automatically" change to incorrect values when you update other properties under "Project Properties -> Android Options". The incorrect values can cause secondary symptoms like Bug 30334 where breakpoints are not hit in the Debug configuration.

    • Non-public Bug 30057 - [Android] Windows only: the debugger will not be able resolve breakpoints unless "Shared Runtime" is ON and the Linker is OFF (under "Project Properties -> Android Options" in Visual Studio or "Project Options -> Android Build" in Xamarin Studio).

    • Bug 29326 - [Android] String resources defined in NuGet packages overwrite sting resources defined in app project, causing the displayed app name to be incorrect for example. Workaround: avoid using the same string key that is used in the NuGet packages.

    • Bug 30548 - [Android] Under certain conditions new threads take several seconds to start. This problem seems to be triggered by Xamarin.Insights 1.10. Partial workarounds: downgrade Xamarin.Insights to version 1.9, or remove it entirely.

    • [Bug 30072](https://bugzilla.xamarin.com/show_bug.cgi?id=30072) - [Xamarin Studio] [Android] Xamarin Studio sometimes crashes with SIGABRT in gtk_text_view_validate_onscreen() after password is entered during "Import an Existing Key" in "Build -> Archive for Publishing -> Sign and Distribute" workflow.

    • Non-public Bug 29170 - [Android] Profiling via log:sample causes the app to crash at startup. Now fixed in the Alpha and Beta channels.

    • Non-public Bug 29538 - [Android] Profiling via the graphical Xamarin Profiler ("Run -> Start Profiling") causes the app to crash at startup.

    • Non-public Bug 28557 - [Android] In certain cases breakpoints will only pause program execution the first time they are hit. Now fixed in the Alpha and Beta channels.

    • Bug 29039 - [Mono] [iOS] [Android] CultureInfo.GetCultureInfo("ar-SA").DateTimeFormat throws a NullReferenceException for the ar-SA culture. Now fixed in the Alpha and Beta channels.

    • Bug 29731 - [Android] Android.Bluetooth.BluetoothAdapter.Enable is incorrectly marked as [Obsolete("deprecated")] for API level 20 and higher.

    • Non-public Bug 29725 - [Xamarin Studio] [iOS] [Android] Expressions in the Watch window are cleared each time you stop debugging.

    • Bug 28210 - [XamarinVS] [Android] New projects created from templates show ignorable build warning: "@(Content) build action is not supported ... AndroidManifest.xml". Workaround: change the build action of "AndroidManifest.xml" to "none". Now fixed in the Alpha and Beta channels.

    New known issues in new features

    • [Android] The AOT compiler does not prevent multithreaded apps from being targeted to the armeabi architecture. These apps will crash at runtime because the armeabi architecture does not support multiple threads.

    • [Android] Some AOT compilation scenarios fail by design but do not yet offer informative error messages.

    • Non-public Bug 28600 - [Android] Intermediate AOT LLVM build files are written to the base project directory rather than the obj/ folder.

    • Non-public Bug 28929 - [XamarinVS] [Android] The F# project template does not create a valid project in VS 2010.

    Latest edits

    EDIT May 19: Update the "fixed in" annotations to mention the new Beta channel release.
    EDIT May 21: Increase severity ranking of Android Bug 28995 based on additional customer reports.
    EDIT May 21: Add Mono Bug 30171, Android Bug 30057, iOS bug 29605, iOS Bug 30059.
    EDIT May 21: Update versions for XamarinVS and iOS iTunesMetadata.plist hotfix (also fixes 29703). Delete some of the old EDIT history for simplicity. Add Android Bug 30318, Xamarin Studio Bug 30072.
    EDIT May 27: Add XVS.Android Bug 30371. Beta channel now fixes 30171. Reset status of 29680 29220 29628 29839 because the "3.11.456" release notes were incorrect.
    EDIT May 28: Add Android Bug 30548, iOS Bug 30420.

    Friday, April 3, 2015 12:57 AM

All replies

  • User76524 posted

    Hi Brendan,

    Lets say if I upgraded to Xamarin.Android 5.1 in Visual Studio, Is there a way to revert back to older stable release? I am using Microsoft Visual Studio Professional 2013.

    Thanks Anand

    Monday, April 13, 2015 9:22 AM
  • User13824 posted

    Sure thing Anand.0760. The easiest option is to downgrade back to the current Stable version by switching back to the Stable updater channel. See also guideline #1 ("You can downgrade back to Stable...") in the first post in this thread for a few more details.

    Monday, April 13, 2015 6:09 PM
  • User123 posted

    Will this mean that we have to recompile all existing libraries with views in them and add [Register] for them to work properly with 5.1+?

    Monday, April 20, 2015 1:36 PM
  • User960 posted

    I tried upgrading to 5.1 and my application now deploys with "$projectname$" instead of the true name defined in the manifest.

    Tuesday, April 21, 2015 1:26 PM
  • User60094 posted

    This version broke my bindings. I can't build project , because null reference exception in method get_JavaName . I think problem in new names of generated classes.

    Wednesday, April 22, 2015 7:24 AM
  • User13824 posted


    • If you use view class= syntax in the .axml files:

      <view class="myandroidlibrary.MyCustomView" android:layout_width="match_parent" android:layout_height="wrap_content" />

      Then yes, you will need to add a [Register("myandroidlibrary.MyCustomView")] attribute on the MyCustomView C# class.

    • If you instead use "XML element name" syntax in the .axml files (see "If your custom View component is not defined as an inner class" in the Custom Components docs):

      <MyAndroidLibrary.MyCustomView android:layout_width="match_parent" android:layout_height="wrap_content" />

      Then no, you will not need to add a Register attribute. Xamarin.Android will replace "MyAndroidLibrary" with the correct MD5 sum automatically while pre-processing the .axml file, before the Java build phase.

    I have updated the first post in this thread to mention this distinction.

    Thursday, April 23, 2015 5:49 AM
  • User13824 posted

    @JonathanChapman, by luck it looks like another user might have reported that same problem along with a test case to reproduce the issue here: https://bugzilla.xamarin.com/show_bug.cgi?id=29326.

    If you suspect the issue you're seeing is different from that bug report, feel free to file another bug report that has its own attached test case, and then paste the bug link back on this thread. Thanks!

    Thursday, April 23, 2015 6:00 AM
  • User960 posted

    Thanks @BrendanZagaeski I do have Insights in my project so it would appear that this is the same bug.

    Thursday, April 23, 2015 12:14 PM
  • User5953 posted

    i got this problem

    Sunday, April 26, 2015 10:38 PM
  • User13824 posted

    Halukmy, interesting. If manually deleting all of the bin and obj folders and then rebuilding does not solve the problem, the most direct way forward would be if you could zip up and attach your full project (or even better, a trimmed down test case that still demonstrates the same problem) on a new bug report (if this link redirects to the top-level kb.xamarin.com/ page the first time you click it, try clicking it once more), and then add a link to the new bug report back on this thread. (Be sure to include your detailed version information such as Android SDK Tools version in the bug report.) I searched for any existing bug reports that mention the same error message, but so far I haven't found any.

    Thanks in advance!

    Sunday, April 26, 2015 11:53 PM
  • User13824 posted

    These versions have now been released to the Stable channel. The first post in the thread has been updated accordingly.

    Wednesday, April 29, 2015 6:40 PM
  • User98240 posted

    Does enabled pro guard support also obfuscate crash reports in insights, or are stack traces still readable? Also the android pro guard documentation states there should be a mapping.txt, i cant find it in the release folder :(?

    Wednesday, April 29, 2015 7:17 PM
  • User2267 posted

    I just installed the stable updates you released today. My Android projects no longer build. I was building and running them just fine prior to the update. The first and only error in the build log is:

    Target _CompileToDalvik: Tool /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/bin/java execution started with arguments: -jar /Developer/android-sdk-macosx/build-tools/18.0.1//lib/dx.jar --no-strict --dex --output=obj/Debug/android/bin obj/Debug/android/bin/classes /Library/Frameworks/Mono.framework/External/xbuild-frameworks/MonoAndroid/v4.4/mono.android.jar /Users/David/.local/share/Xamarin/Android.Support.v13/20.0.0/content/support/v13/android-support-v13.jar unknown output extension: obj/Debug/android/bin usage: dx --dex [--debug] [--verbose] [--positions=