I have an Android Library project which has a part in C/C++ via Android NDK. I want to build my native code for all architectures. If i set minSdkVersion
to 21 it all works fine. but i need to have lower minSdkVersion
(SDK 19) if i set minSdkVersion
to 19 the ARM64-v8a version is not built. I know that there are no ARM64-v8a devices running SDK 19. How can i achieve to have all platforms built in one APK and have minSdkVersion
19?
Asked
Active
Viewed 1.1k times
5

emKaroly
- 756
- 1
- 10
- 22
1 Answers
5
Actually, there is typo in "minimumSdkVersion". The right attribute is "minSdkVersion".
However, arm64-v8a library should be successfully built for API 19, because NDK build scripts will automatically take right set of platform headers and libraries.
If you are using Gradle build scripts try to set it as one of target ABIs:
ndk {
abiFilters 'arm64-v8a', 'armeabi-v7a'
}
Then, explicitly set target platform for native build.
If you use CMake, then in gradle script set:
externalNativeBuild {
cmake {
arguments '-DANDROID_PLATFORM=android-19'
}
}
If you use ndk-build, then in your Application.mk set:
APP_PLATFORM := android-19
I hope that helps. Please, write details if it will not build.

Sheikh
- 1,116
- 6
- 15
-
1You are right, its minSdkVersion, but the build doesn't produce arm64-v8a libraries if i set minSdkVersion to 19. And only changing it back to 21 makes gradle build these arm64 .so files – emKaroly Dec 15 '16 at 07:26
-
I found that previously there was bug in Android Studio 2.0.x. See here [issue](https://code.google.com/p/android/issues/detail?id=195135). What are you using? Provide details. – Sheikh Dec 15 '16 at 08:48
-
I am using Android Studio 2.2.3 and experimental gradle plugin 0.8.2. So basically what i have to do is set the minSdkVersion to 21 and individually set 19 for every every platform except arm64-v8a – emKaroly Dec 15 '16 at 09:02
-
Oh, experimental plugin has enough problems. Yes, basically, you will need to separate your build. Here is interesting [link](http://www.eegeo.com/2016/10/native-android-development-using-android-studio/) how guys are struggling with experimental plugin. – Sheikh Dec 16 '16 at 06:06
-
Well i am struggling with experimental plugin too. I would like to migrate the project to stable version. I also asked few questions about that, with not so much success. [question1](http://stackoverflow.com/questions/40909370/migrate-native-module-from-gradle-experimental-plugin-to-stable-gradle) [question2](http://stackoverflow.com/questions/40906107/how-to-access-versioncode-from-task-in-gradle-experimental-plugin) – emKaroly Dec 16 '16 at 06:27