gradle + ndkbuild + android studio 2.2 how to set supported ABIs?
Asked Answered
F

1

10

I want to use android studio integration with ndkbuild.

My "native" part of project build only for armeabi-v7a-hard and x86, and all works fine if I just run ndk-build in jni directory. I have proper lines in Application.mk:

APP_ABI := armeabi-v7a-hard x86

To integration project into android studio I added such lines into build.gradle:

externalNativeBuild {
    ndkBuild {
        path 'src/lib/jni/Android.mk'
    }
}

But for some reason gradle build try build native code with APP_ABI=armeabi and failed, because of my code can only be build with armeabi-v7a-hard.

So how can I tell gradle to build my code only for armeabi-v7a-hard and x86, or just not ignore APP_ABI line from Application.mk?

I try such variant:

defaultConfig {
    ndk {
      abiFilters 'x86', 'armeabi-v7a-hard'
    }
}

but gradle failed with such message:

ABIs [armeabi-v7a-hard] are not available for platform and will be excluded from building and packaging. Available ABIs are [armeabi, armeabi-v7a, arm64-v8a, x86, x86_64, mips, mips64].

Note, that I use ndk 10, not last one (ndk 13), where there is armeabi-v7a-hard, and ndk.dir in local.properties to right value.

Florinda answered 6/12, 2016 at 11:3 Comment(1)
P
1

Link provided by @Titan is all you need to set the ABI.

The reason why it might not be working is because armeabi-v7a-hard is deprecated in 2015, so targeting it is resulting in this issue. You should target armeabi-v7a as per this this post

Powers answered 13/7, 2018 at 9:6 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.