Is there a way to specify processor architecture requirement in the Android manifest?
Asked Answered
P

3

6

I'm using a native library in my Android project that is compiled to armeabi-v7. My project targets Android SDK 8. When I try to run it with my phone unplugged, auto-targetting picks an Android 2.2 (armeabi) virtual device instead of the 4.03 (armeabi-v7) and tries to install it on that, but that throws a Failed to install apk on device 'emulator! error.

I cannot find a way to specify the required processor architecture, which seems strange considering you can specify the Android SDK version, hardware requirements (like hardware keyboard) with <uses-configuration>, many more hardware requirements and even OpenGL version with <uses-feature> in the AndroidManifest.xml.

Is there a way to specify that?

Paean answered 24/4, 2012 at 12:56 Comment(1)
perhaps using certain folders in the libs directory suggests the supported architecture restriction of your app and then the android market handles them appropriately?Pyrexia
I
1

No, there is not way of doing this which is strange, I agree. There's one way of specifying the architecture (setting APP_ABI := armeabi-v7a in Application.mk) but this is only taken into account when building the native libraries, not when selecting an appropriate emulator.

Incumbent answered 24/4, 2012 at 13:37 Comment(0)
F
1

You can set it in the build gradle file:

https://developer.android.com/games/optimize/64-bit#android-studio-gradle

// Your app's build.gradle

android {
   ...
   defaultConfig {
       ...
       ndk.abiFilters 'armeabi-v7a','arm64-v8a','x86','x86_64'

Alternative of the same thing: https://developer.android.com/ndk/guides/abis#gc

android {
    defaultConfig {
        ndk {
            abiFilters 'armeabi-v7a','arm64-v8a','x86','x86_64'
        }
    }
}

You can also put just what you need in debug&release, in the folders of "src/debug/jniLibs" and "src/release/jniLibs" , as demonstrated here for a different purpose:

https://blog.dipien.com/stop-generating-the-buildconfig-on-your-android-modules-7d82dd7f20f1

Favour answered 7/8, 2023 at 6:19 Comment(0)
G
0

But note that when you publish your app to Google Play target architectures are considered as market filters and you can see them on your dev console.

Goodrow answered 24/4, 2012 at 13:40 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.