I'm trying to build an arm-only app (https://github.com/Mearitek/MeariSdk/tree/MeariSdk-5.0.0) with a fresh Android Studio 2023 install and that does not seem to work because Android Studio seems to insist to create split build APKs and does not find any NDK libraries matching x86_64.
I setup an AVD which allows executing universal binaries with ARM code (all the latest Android x86_64 builds do...) as I did in older Android Studio but here I seem unable to tell it that this AVD is able to process ARM code.
More specifically I get this error:
> Configure project :app
WARNING: Cannot build selected target ABI: x86_64, no suitable splits configured: armeabi-v7a, arm64-v8a;
WARNING: Cannot build selected target ABI: x86_64, no suitable splits configured: armeabi-v7a, arm64-v8a;
Given the error message gradle is clearly trying to "help me" by building a split APK which only contains x86_64 NDK, which is clearly causing it to fail since the project itself does not contain any NDK lib targetting that environment.
The obvious solution would have been to configure Android Studio so that the release/debug build variants create universal binaries (so to allow the AVD to play its magic) however the "build variants" window does not allow me to select ABI/Universal:
I tried various suggestions in order to achieve this via gradle config to no avail (e.g. Android App Bundle, Disable Language and Density Split on Base Module or All module) but with fresh Android Studio install I seem to be unable to force building and universal binary.
I've tried commenting the abiFilters but this has the effect to build an APK targetted at x86, thus without any of the needed .so libraries and the app does not work:
loadLibrary failed:dlopen failed: library "libhv.so" not found
so:
As seen from the message:
It would probably be equally good to "explain" to Android Studio that this AVD can run arm software... But I'm not an Android expert and don't know how to do it! :-(
After multiple attempts it turns out I was using an image which indeed does NOT support cross-architecture libraries, thus Android Studio was correctly singaling that. I was using an image:
whereas I resolved by installing:
you can easily check if you too are meeting the same problem by drag&drop of an APK which uses ARM libs on the android emulator: if it says it's not able to install because of architecture then the problem is actually the image!