android: Android App Bundles Crashing on Startup
Steps to Reproduce
Build a project with the following configuration
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'PROD|AnyCPU' ">
<DebugType>
</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\PROD</OutputPath>
<DefineConstants>PROD</DefineConstants>
<WarningLevel>4</WarningLevel>
<AndroidLinkMode>Full</AndroidLinkMode>
<JavaMaximumHeapSize>
</JavaMaximumHeapSize>
<EmbedAssembliesIntoApk>true</EmbedAssembliesIntoApk>
<AndroidUseSharedRuntime>false</AndroidUseSharedRuntime>
<AndroidDexTool>d8</AndroidDexTool>
<BundleAssemblies>false</BundleAssemblies>
<AndroidLinkTool>r8</AndroidLinkTool>
<AndroidAotAdditionalArguments>no-write-symbols,nodebug</AndroidAotAdditionalArguments>
<AndroidHttpClientHandlerType>System.Net.Http.HttpClientHandler</AndroidHttpClientHandlerType>
<AotAssemblies>true</AotAssemblies>
<EnableLLVM>true</EnableLLVM>
<AndroidUseAapt2>true</AndroidUseAapt2>
<AndroidPackageFormat>aab</AndroidPackageFormat>
<AndroidSupportedAbis>arm64-v8a;armeabi-v7a</AndroidSupportedAbis>
<AndroidEnableProfiledAot>false</AndroidEnableProfiledAot>
</PropertyGroup>
Used MSBuild to build the project as mentioned in #2727
Opened app in One Plus One, the app crash after Splash screen Opened app in One Plus Six, the app works fine Crashed in Galaxy Prime, Lenovo
When I tried adding x86 to the SupportedAbis, the behaviour was different, the app was stuck at splash screen.
Apk Build works fine in every phone.
Expected Behavior
Should Open App in every phone without crash
Actual Behavior
App crashes during startup in most of the phones.
Version Information
Microsoft Visual Studio Community 2019 Preview Version 16.2.0 Preview 3.0 VisualStudio.16.Preview/16.2.0-pre.3.0+29021.104 Microsoft .NET Framework Version 4.7.03056
Installed Version: Community
Azure App Service Tools v3.0.0 16.2.226.19058 Azure App Service Tools v3.0.0
C# Tools 3.2.0-beta3-19312-05+5905d757a89126ebbcdb383b1a10cadda8c6fdc3 C# components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.
Common Azure Tools 1.10 Provides common services for use by Azure Mobile Services and Microsoft Azure Tools.
Extensibility Message Bus 1.2.0 (d16-2@8b56e20) Provides common messaging-based MEF services for loosely coupled Visual Studio extension components communication and integration.
IntelliCode Extension 1.0 IntelliCode Visual Studio Extension Detailed Info
Microsoft JVM Debugger 1.0 Provides support for connecting the Visual Studio debugger to JDWP compatible Java Virtual Machines
Microsoft MI-Based Debugger 1.0 Provides support for connecting Visual Studio to MI compatible debuggers
Mono Debugging for Visual Studio 16.2.3 (373927b) Support for debugging Mono processes with Visual Studio.
NuGet Package Manager 5.2.0 NuGet Package Manager in Visual Studio. For more information about NuGet, visit https://docs.nuget.org/
ProjectServicesPackage Extension 1.0 ProjectServicesPackage Visual Studio Extension Detailed Info
ResourcePackage Extension 1.0 ResourcePackage Visual Studio Extension Detailed Info
ResourcePackage Extension 1.0 ResourcePackage Visual Studio Extension Detailed Info
Visual Basic Tools 3.2.0-beta3-19312-05+5905d757a89126ebbcdb383b1a10cadda8c6fdc3 Visual Basic components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.
Visual F# Tools 10.4 for F# 4.6 16.2.0-beta.19306.3+3de631a4ba0f54953bad33661008d39fb6df7669 Microsoft Visual F# Tools 10.4 for F# 4.6
Visual Studio Code Debug Adapter Host Package 1.0 Interop layer for hosting Visual Studio Code debug adapters in Visual Studio
VisualStudio.Mac 1.0 Mac Extension for Visual Studio
Xamarin 16.2.0.81 (d16-2@df3a2fccb) Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android.
Xamarin Designer 16.2.0.289 (remotes/origin/d16-2@495a9f28a) Visual Studio extension to enable Xamarin Designer tools in Visual Studio.
Xamarin Templates 16.3.113 (866233a) Templates for building iOS, Android, and Windows apps with Xamarin and Xamarin.Forms.
Xamarin.Android SDK 9.4.0.34 (d16-2/7cce305) Xamarin.Android Reference Assemblies and MSBuild support. Mono: mono/mono/2019-02@c6edaa62f94 Java.Interop: xamarin/java.interop/d16-2@b2b2610 LibZipSharp: grendello/LibZipSharp/d16-2@caa0c74 LibZip: nih-at/libzip/rel-1-5-1@b95cf3f ProGuard: xamarin/proguard/master@905836d SQLite: xamarin/sqlite/3.27.1@8212a2d Xamarin.Android Tools: xamarin/xamarin-android-tools/master@4f717b6
Xamarin.iOS and Xamarin.Mac SDK 12.14.0.93 (55ad141) Xamarin.iOS and Xamarin.Mac Reference Assemblies and MSBuild support.
Log File
I could share the source code / apk / app bundles privately to the Xamarin Android team
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Comments: 59 (18 by maintainers)
Commits related to this issue
- Remove __XA_DSO_IN_APK in favor of runtime checks Fixes: https://github.com/xamarin/xamarin-android/issues/3298 Context: https://github.com/xamarin/xamarin-android/issues/3298#issuecomment-509022428 ... — committed to jonathanpeppers/xamarin-android by jonathanpeppers 7 years ago
- Remove __XA_DSO_IN_APK in favor of runtime checks Fixes: https://github.com/xamarin/xamarin-android/issues/3298 Context: https://github.com/xamarin/xamarin-android/issues/3298#issuecomment-509022428 ... — committed to jonathanpeppers/xamarin-android by jonathanpeppers 7 years ago
- [monodroid] Remove __XA_DSO_IN_APK in favor of runtime checks (#3337) Fixes: https://github.com/xamarin/xamarin-android/issues/3298 Context: https://github.com/xamarin/xamarin-android/issues/3298#is... — committed to dotnet/android by jonathanpeppers 7 years ago
- [monodroid] Remove __XA_DSO_IN_APK in favor of runtime checks (#3337) Fixes: https://github.com/xamarin/xamarin-android/issues/3298 Context: https://github.com/xamarin/xamarin-android/issues/3298#is... — committed to dotnet/android by jonathanpeppers 7 years ago
Release status update
A new Release version has now been published that includes the fix for this item.
Fix included in Xamarin.Android 10.0.0.43
Fix included on Windows in Visual Studio 2019 version 16.3. To get the new version that includes the fix, check for the latest updates or install the latest version from https://visualstudio.microsoft.com/downloads/.
Fix included on macOS in Visual Studio 2019 for Mac version 8.3. To get the new version that includes the fix, check for the latest updates on the Stable updater channel.
@GustavoMx I wouldn’t try to deploy/install these APK files yourself, use
bundletoolto install:More docs here:
Alternatively you can do:
I also wouldn’t use
AndroidCreatePackagePerAbi=TrueandAndroidPackageFormat=aabat the same time, but it doesn’t look like that is causing a problem for you.Great to see that #3337 was merged ! Thanks a lot to everyone who worked on it !
Any idea on when we will be able to try this in a preview release of Visual Studio for Mac ?
I built by using latest VS for Mac Preview and it works
@jonathanpeppers I totally missed that!! Just made my pipeline stable!!! Thanks a bunch
@jonathanpeppers, I have applied your recommendations and now the direct installation with bundletool works right! The app does not crash when run! thank you very much for the suggestions and the solution.
@shanranm if you are waiting on your org to approve the extension for boots, you might be able to just script it instead as described on the README. The extension is a “nice to have”.
I update successful the aab file but there are an issue that. The app run failed on Android version less than version 9 on Pre-launch App feature.
Great work @johnthiriet for narrowing down the issue, and great work @jonathanpeppers for the PR. Lots to learn from all this for me:)
I wrote some notes about
extractNativeLibswhen I implemented app bundles with bundletool 0.8.0 at the time: https://github.com/xamarin/xamarin-android/blob/master/Documentation/guides/app-bundles.md#native-librariesIt appears the logic that determines if native libraries are compressed has changed…
After reading their code and seeing this
isInstallableOnExternalStorage()method, does addingandroid:installLocation="preferExternal"help?https://developer.android.com/guide/topics/manifest/manifest-element
I will do some research to figure out what we need to do here. It seems on some devices that the native libraries are being compressed and that causes the crash.