MatrixDev/GradleAndroidRustPlugin

filter out x86_64 so will fail Run for x86_64 emulator

Closed this issue · 3 comments

tkkcc commented

2023-04-11_23-51

I have this user case:
As x86_64 arch can use x86 lib, I won't bundle x86_64 lib for smaller size, than I specific other 3 targets in release buildType. The problem is I can't "Run" in release build variant on a x86_64 emulator(genymotion), it report lib missing. But the "Make" out apk can run on it as expected. In order to "Run" in such case, I have to switch to debug build variant or editing targets in release builtType.

I guess it's may not be a problem releted to this plugin.

I think it might be. Plugin checks which arch is app being deployed to and builds only related version of the library to minimize a build time. Will check tomorrow I'm correct.

This is not a plugin bug after all. Library so file is built correctly and gradle event strips it (you can find it in intermediates/stripped_native_libs folder). AS itself doesn't include the library because it doesn't match target device arch.

I found that you can fix it by providing all supported abis:

android {
    defaultConfig {
        ndk {
            abiFilters.add("x86")
            abiFilters.add("arm64-v8a")
            abiFilters.add("armeabi-v7a")
        }
    }
}
tkkcc commented

Works. Thanks!