Repository navigation
Description
Steps to Reproduce
- Set your Android project as the startup project
- Select the
Releaseconfiguration - In your Android project settings, under Android Build > General, set the package format to
aab - Under Advanced, ensure x86 is enabled as a supported ABI
- Build and deploy your app to a simulator running Android 9.0 (Pie) - x86
- The app freezes on the splash screen (before OnCreate)
- Logs show the app is throwing a mono exception, crashing, and restarting
As a note, a crash does not occur on Android 7.1, 8.1, and 10.0.
Expected Behavior
The app does not crash on launch when using aab on Android 9.0.
Actual Behavior
The app crashes on Android 9.0 after a mono exception and appears to freeze on the launch screen.
Version Information
=== Visual Studio Community 2019 for Mac ===
Version 8.6.5 (build 23)
Installation UUID: 569a2032-b97f-4417-8a14-45ffe1b65f41
GTK+ 2.24.23 (Raleigh theme)
Xamarin.Mac 6.18.0.23 (d16-6 / 088c73638)
Package version: 610000104
=== Mono Framework MDK ===
Runtime:
Mono 6.10.0.104 (2019-12/5d03a6fe116) (64-bit)
Package version: 610000104
=== Roslyn (Language Service) ===
3.6.0-3.20210.9+4eafdcb1bcbd8d3573f2ba6065e56d9b9ce4f8a3
=== NuGet ===
Version: 5.6.0.6591
=== .NET Core SDK ===
SDK: /usr/local/share/dotnet/sdk/3.1.301/Sdks
SDK Versions:
3.1.301
3.1.300
3.1.200
3.1.101
3.1.100
3.0.101
3.0.100
2.1.701
MSBuild SDKs: /Library/Frameworks/Mono.framework/Versions/6.10.0/lib/mono/msbuild/Current/bin/Sdks
=== .NET Core Runtime ===
Runtime: /usr/local/share/dotnet/dotnet
Runtime Versions:
3.1.5
3.1.4
3.1.2
3.1.1
3.1.0
3.0.1
3.0.0
2.1.19
2.1.18
2.1.16
2.1.15
2.1.14
2.1.13
2.1.12
=== Xamarin.Profiler ===
Version: 1.6.12.29
Location: /Applications/Xamarin Profiler.app/Contents/MacOS/Xamarin Profiler
=== Updater ===
Version: 11
=== Xamarin.Android ===
Version: 10.3.1.4 (Visual Studio Community)
Commit: xamarin-android/d16-6/3a10de9
Android SDK: /Users/cpearson/Library/Developer/Xamarin/android-sdk-macosx
Supported Android versions:
7.1 (API level 25)
8.1 (API level 27)
SDK Tools Version: 26.1.1
SDK Platform Tools Version: 29.0.5
SDK Build Tools Version: 29.0.2
Build Information:
Mono: 165f4b0
Java.Interop: xamarin/java.interop/d16-6@2cab35c
ProGuard: xamarin/proguard@905836d
SQLite: xamarin/sqlite@49232bc
Xamarin.Android Tools: xamarin/xamarin-android-tools/d16-6@bfb66f3
=== Microsoft OpenJDK for Mobile ===
Java SDK: /Users/cpearson/Library/Developer/Xamarin/jdk/microsoft_dist_openjdk_1.8.0.25
1.8.0-25
Android Designer EPL code available here:
https://github.com/xamarin/AndroidDesigner.EPL
=== Android SDK Manager ===
Version: 16.6.0.50
Hash: 5901879
Branch: remotes/origin/d16-6
Build date: 2020-06-10 22:42:50 UTC
=== Android Device Manager ===
Version: 16.6.0.96
Hash: 6e8b80b
Branch: remotes/origin/d16-6
Build date: 2020-06-10 22:43:28 UTC
=== Xamarin Designer ===
Version: 16.6.0.329
Hash: d4f8bcd13
Branch: remotes/origin/d16-6
Build date: 2020-04-24 02:16:02 UTC
=== Apple Developer Tools ===
Xcode 11.5 (16139)
Build 11E608c
=== Xamarin.Mac ===
Xamarin.Mac not installed. Can't find /Library/Frameworks/Xamarin.Mac.framework/Versions/Current/Version.
=== Xamarin.iOS ===
Version: 13.18.2.1 (Visual Studio Community)
Hash: 29c4ea731
Branch: d16-6
Build date: 2020-05-26 17:03:05-0400
=== Build Information ===
Release ID: 806050023
Git revision: 5289d413b99fddfc20b4ecf3e445ccb822213427
Build date: 2020-06-18 12:08:30-04
Build branch: release-8.6
Xamarin extensions: 5289d413b99fddfc20b4ecf3e445ccb822213427
=== Operating System ===
Mac OS X 10.15.4
Darwin 19.4.0 Darwin Kernel Version 19.4.0
Wed Mar 4 22:28:40 PST 2020
root:xnu-6153.101.6~15/RELEASE_X86_64 x86_64
Activity
jonathanpeppers commentedon Jul 7, 2020
Maybe @grendello or @brendanzagaeski have seen something like this:
Is this related to typemaps?
I don't know why using an app bundle on Android 9.0 would cause this.
@codympearson do you see this problem on any app (even hello world) or just your app?
codympearson commentedon Jul 7, 2020
Hi @jonathanpeppers, I have not tried with a hello world app, but I have seen this issue in two separate Xamarin.Forms applications I am working on currently (one significantly less complex than the other). If I use AAB in debug, both apps run on Android 9.0. Switching to release, AAB crashes on Android 9.0. I have ruled out the AndroidX packages, as the issue occurs on one project that has not migrated yet.
jonathanpeppers commentedon Jul 9, 2020
@codympearson I tried your steps above with the Xamarin.Forms Shell template and it worked for me on an Android 9.0 x86 emulator.
Is there something specific in your app causing this? Are you able to create a new project that shows the same problem?
If you enable Mono debug logging for the running emulator via:
And relaunch the app, it might give more information in the log. Attach that here, thanks!
codympearson commentedon Jul 9, 2020
@jonathanpeppers I've uploaded a repro project and log with the requested mono debug logging at the bottom of my post. I created a blank Xamarin.Forms app with Xamarin.Forms 4.6.0, switched the Android project to use AAB in release, ran it, and was able to reproduce the crash. Thanks for looking into this! Here's the interesting piece:
jonathanpeppers commentedon Jul 9, 2020
Thanks, @codympearson I can reproduce the bug above now.
@grendello when I do a diff between an
.apkand the.aabthe only file I've found that differs islibxamarin-app.so:libxamarin-app.so.zip
Can you tell if there is something odd in here? The .NET assemblies and
classes.dexare identical.grendello commentedon Jul 10, 2020
@jonathanpeppers the
libxamarin-app.sobinaries are identical except for the different build id, which you noticed on Slack. The type maps are identical.jonathanpeppers commentedon Jul 10, 2020
After more testing, we can reproduce this issue in a "hello world" app:
https://github.com/xamarin/xamarin-android/tree/master/samples/HelloWorld
If you add
<application android:extractNativeLibs="false"toAndroidManifest.xml. App bundles happen to use this setting.It seems to only occur on an x86 Android 9.0 emulator, the x86_64 emulator works.
Work around an Android 9 dlopen bug on x86
Work around an Android 9 dlopen bug on x86
Work around an Android 9 dlopen bug on x86
Work around an Android 9 dlopen bug on x86
Work around an Android 9 dlopen bug on x86
5 remaining items
Work around an Android 9 dlopen bug on x86
Work around an Android 9 dlopen bug on x86
Work around an Android 9 dlopen bug on x86
Work around an Android 9 dlopen bug on x86
Work around an Android 9 dlopen bug on x86
Work around an Android 9 dlopen bug on x86
Work around an Android 9 dlopen bug on x86
[monodroid] Work around an Android 9 dlopen bug on x86 (#4914)
[monodroid] Work around an Android 9 dlopen bug on x86 (#4914)
brendanzagaeski commentedon Aug 26, 2020
Release status update
A new Preview version of Xamarin.Android has now been published that includes the fix for this item. The fix is not yet included in a Release version. I will update this item again when a Release version is available that includes the fix.
Fix included in Xamarin.Android SDK version 11.0.99.34.
Fix included on Windows in Visual Studio 2019 version 16.8 Preview 2. To try the Preview version that includes the fix, check for the latest updates in Visual Studio Preview.
Fix included on macOS in Visual Studio 2019 for Mac version 8.8 Preview 2. To try the Preview version that includes the fix, check for the latest updates on the Preview updater channel.
brendanzagaeski commentedon Nov 10, 2020
Release status update
A new Release version of Xamarin.Android has now been published that includes the fix for this item.
Fix included in Xamarin.Android SDK version 11.1.0.17.
Fix included on Windows in Visual Studio 2019 version 16.8. To get the new version that includes the fix, check for the latest updates or install the most recent release from https://visualstudio.microsoft.com/downloads/.
Fix included on macOS in Visual Studio 2019 for Mac version 8.8. To get the new version that includes the fix, check for the latest updates on the Stable updater channel.