Bug 46551 - Unsupported ABIs are not filter from included libraries in apk files
Summary: Unsupported ABIs are not filter from included libraries in apk files
Status: RESOLVED FIXED
Alias: None
Product: Android
Classification: Xamarin
Component: Linker ()
Version: 6.1.2 (C7SR1)
Hardware: PC Mac OS
: --- normal
Target Milestone: ---
Assignee: Radek Doulik
URL:
Depends on:
Blocks:
 
Reported: 2016-11-07 21:49 UTC by Pete Schmitz
Modified: 2017-06-27 17:31 UTC (History)
2 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:


Attachments
Project that supports armeabi-v7, library that also includes other ABI support (10.79 KB, application/zip)
2016-11-07 21:49 UTC, Pete Schmitz
Details


Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and 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 Links.

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.

Related Links:
Status:
RESOLVED FIXED

Description Pete Schmitz 2016-11-07 21:49:38 UTC
Created attachment 18360 [details]
Project that supports armeabi-v7, library that also includes other ABI support

Issue:

 - 64-bit devices will crash against a Xamarin Android apk (with exception java.lang.UnsatisfiedLinkError) if only 32-bit ABIs are selected, but a library with 64-bit ABI support is included in the project.


Expected behavior:

 - Include ABI mono libraries implicitly when an included library contains ABIs that are left unselected for "Supported ABIs" 
 - Or filter out non-supported library ABIs so devices don't attempt to resolve against those non-supported ABIs (it's my understanding that arm64-v8a devices will fallback to armeabi-v7).


Reproduction:

 - Create a Android Xamarin project 
 - (armeabi-v7 is selected by default for supported ABI)
 - Add a library (Our offender is Twilio.Xamarin IP messaging)
 - Select "Release" configuration, archive and sign an apk
 - Deploy the apk on a 64-bit arm device (arm64-v8a)
 - Application crashes because the mono so library isn't included for arm64



Xamarin Studio Community (6.1.1)
Xamarin Android (6.1.2.21)
SDK Tools (25.2.2)
SDK Platform Tools (23.0.1)
SDK Build Tools (23.0.2)


Stack:

java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/com.survey.android-1/base.apk"],nativeLibraryDirectories=[/data/app/com.survey.android-1/lib/arm64, /data/app/com.survey.android-1/base.apk!/lib/arm64-v8a, /vendor/lib64, /system/lib64]]] couldn't find "libmonodroid.so"
	at java.lang.Runtime.loadLibrary(Runtime.java:367)
	at java.lang.System.loadLibrary(System.java:1076)
	at mono.MonoPackageManager.LoadApplication(MonoPackageManager.java:34)
	at mono.MonoRuntimeProvider.attachInfo(MonoRuntimeProvider.java:22)
	at android.app.ActivityThread.installProvider(ActivityThread.java:6775)
	at android.app.ActivityThread.installContentProviders(ActivityThread.java:6370)
	at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6310)
	at android.app.ActivityThread.access$1800(ActivityThread.java:222)
	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1861)
	at android.os.Handler.dispatchMessage(Handler.java:102)
	at android.os.Looper.loop(Looper.java:158)
	at android.app.ActivityThread.main(ActivityThread.java:7237)
	at java.lang.reflect.Method.invoke(Native Method)
	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)
Comment 1 Pete Schmitz 2016-11-07 21:53:17 UTC
Comment on attachment 18360 [details]
Project that supports armeabi-v7, library that also includes other ABI support

When the apk produced by this project is unzipped, you will notice the lib folder fails to include mono lib on unsupported ABIs.

If the apk is ran on a 64-bit device, like the S6, it'll crash on startup with a java.lang.UnsatisfiedLinkError exception
Comment 2 Cody Beyer (MSFT) 2017-06-27 17:31:25 UTC
Thank you for taking the time to submit this report. After reviewing the description of this bug, we believe it no longer affects the current version of Xamarin.Android. If you are still experiencing the issue after updating your packages, please reopen this report with an attached reproduction.