In android release configuration, I chose the supported architectures to be : armeabi-v7a and arm64-v8a to support 64-bit android version as Google requires. But, when I take an APK release, the app crashes. The app doesnot crash if I choose only the default armeabi-v7a architecture. The device I tested this on is Nexus 9 (Android 7.1 - API 25). Please assist. Thanks
@paul_mac said:
Please note that before taking release APK in adhoc, I tried Proguard config based build and Dotfuscator. Target Android version is Android 9
I would suggest turning off Proguard and Dotfuscator and set the linker to either None or SDK Only. Try another release build and see if you have the same problem. Just adding an ABI has never caused a problem for me but Proguard, Dotfuscator and linking can all cause issues.
The crash is now resolved for me. Thanks @JonDouglas and @SaamerMansoor. It seems to be the problem with the proguard - maybe it removed my libraries inorder to mnimize the APK size..! I actually reverted the proguard configurations I made, only then the crash got solved. Thought of posting this earlier, didnt have time for that.. Thanks @Irongut
But, I dont understand why?
1. When I use proguard, I get crash on app launch
2. When I use Dotfuscator alone, I get crash on app launch. Please assist. Thanks all
Answers
@paul_mac
Would you be able to upload your
adb logcat
of your application crashing on device? You can grab these a few ways:Another helpful thing would be knowing what abis this device supports. You can do this via a command prompt that has
adb
on the path.adb shell getprop ro.product.cpu.abilist
- provides a list of compatible abisadb shell getprop ro.product.cpu.abi
- provides the best fit abiFeel free to upload those logs and we can help out!
Basic question: I'm trying to do the same thing, but using VS 2019, I can't figure out how to choose supported architectures. Where do you find the option to be able to do that? I'm responding to probably the same Google email as you are and trying to make an app I developed a couple years back support 64-bit... but it's been so long I don't remember much about how to do things with Xamarin. I had such a bad experience developing this one app that I'll likely never use Xamarin again, so my skills (such as they were) have atrophied since I worked on this project.
@kylehumfeld
https://docs.microsoft.com/en-us/xamarin/android/app-fundamentals/cpu-architectures?tabs=windows#how-to-specify-supported-architectures
We are also publishing a blog relatively soon to help out in this area too!
I'd love to hear your experiences with developing your app so we can improve our product if you're open to providing the feedback! Feel free to send me an email to jodou at microsoft dot com
Thanks! I found a different MS page with similar information and hadn't yet circled back to this post to answer my own question.
@kylehumfeld
Go into your Android Project settings -> Android Build ->Advanced tab -> Select Release configuration and enable arm64-v8a as one of your supported ABIs.
Remember to "Rebuild All" before you hit "Archive for Publishing" so that you don't run into issues based on cached data. You can view this article medium.com/@ prototypemakers/64-bit-version-of-your-xamarin-native-or-xamarin-forms-android-app-477d0e637432 for more details
@JonDouglas , Thanks for your response. Here are the logs, the architectures that I have selected in release configuration are - arm64-v8a and x86_64. Device crashed : Nexus 9
I took these logs in my cmd after app crashed. Please assist. Thanks
Please note that before taking release APK in adhoc, I tried Proguard config based build and Dotfuscator. Target Android version is Android 9
I would suggest turning off Proguard and Dotfuscator and set the linker to either None or SDK Only. Try another release build and see if you have the same problem. Just adding an ABI has never caused a problem for me but Proguard, Dotfuscator and linking can all cause issues.
The crash is now resolved for me. Thanks @JonDouglas and @SaamerMansoor. It seems to be the problem with the proguard - maybe it removed my libraries inorder to mnimize the APK size..! I actually reverted the proguard configurations I made, only then the crash got solved. Thought of posting this earlier, didnt have time for that.. Thanks @Irongut
But, I dont understand why?
1. When I use proguard, I get crash on app launch
2. When I use Dotfuscator alone, I get crash on app launch. Please assist. Thanks all
why would someone suggest that and why this is accepted as an answer? those settings are necessary. please dont suggest something like that.
i have exactly the same problem when i enable arm64-v8a, my app is crashing on my Samsung s10+.
I am using AOT+LLVM, bundle into native assemblies, proguard, full linking
@batmaci, I too felt very bad when my app crashed, as I cannot compromise on protecting my app. But, the wonderful thing was that later I found that instead of generating the DotfuscatorConfig.xml on building the platform project (Android/iOS), you can create a custom DotfuscatorConfig.xml config file that kinda tells Dotfuscator what not to rename in your project libraries. The crash basically happens when you use the default config file that will get generated on build, that renames your library codes like XAML InitializeComponent and click events etc..,
Please go through the below link that was helpful for me, now I've protected my release app without crash.
https://www.preemptive.com/blog/article/874-using-dotfuscator-community-edition-with-xamarin/91-dotfuscator-ce
Hope this helps you as well...
@paul_mac i am not using dotfuscator at all just proguard, full linkining and other settings as i mentioned. i spent whole day was thinking something wrong with my coding or new VS studio update and finally figured out that it was the reason to enable arm64-v8a. my app just working fine without using arm64-v8a
This set of settings will increase your apk file size but application will be universal for any platform. Or you can select option "Generate one package per selected abi" then it will be several apks for each platform.

Now if you support armeabi-v7a you get an "error" during upload from visual studio 2019.
Should we uncheck it from now on?