I am trying to build universal apk for all architectures. Here is my project structure:
-App
-appModule
-libraryModule
-libs
-armeabi
-lib.so
-src
-java
-jni
Here is my gradle file for libraryModule:
apply plugin: 'com.android.library'
// http://stackoverflow.com/questions/28485309/how-to-build-single-apk-with-andoid-ndk-and-gradle
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
ndk {
moduleName "ProxyResolver" // <-- This is the name of AndroidProxy native module
stl "gnustl_shared"
cFlags "-std=c++11"
abiFilters = ['armeabi']
ldLibs (projectDir.absolutePath + "/libs/armeabi/libresolver.so")
}
}
sourceSets {
main {
jniLibs.srcDirs = ['libs']
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
}
As you can see the path for library is hardcoded. And right now it works on arm-v7 processors. But i need to add support of x86 without adding a flavor
I guess:
ndk {
moduleName "resolver"
stl "gnustl_shared"
cFlags "-std=c++11"
abiFilters = ['armeabi','arm-v7']
}
And remove
sourceSets {
main {
jniLibs.srcDirs = ['libs']
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With