Previously I had two Android Studio projects. One is using some shared library placed in /src/main/jniLibs
(lets call that project bmf). The second project is my actual library which is using that other project (bmf) as an .aar.
If some application is now using the library I had to add the project with the shared library (bmf) as well because the .so files were not packed. Because I want to merge the two projects to one library project I have imported the bmf project as a module. Now if I assemble the library, the .so file of the module is not included. How can I fix that?
My app-module build script looks like:
apply plugin: 'com.android.library'
android {
compileSdkVersion 15
buildToolsVersion "26.0.2"
lintOptions {
abortOnError false
}
defaultConfig {
minSdkVersion 15
targetSdkVersion 15
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}
dependencies {
compile 'com.android.support:support-v4:18.0.0'
implementation project(':pbJavaBmf')
}
My bmf-module build script looks like:
apply plugin: 'com.android.library'
android {
compileSdkVersion 15
buildToolsVersion "26.0.2"
lintOptions {
abortOnError false
}
defaultConfig {
minSdkVersion 15
targetSdkVersion 15
}
externalNativeBuild {
ndkBuild {
path "src/main/jni/Android.mk"
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
task buildNative(type: Exec, description: 'Pack .so with module') {
def ndkDir = android.ndkDirectory
commandLine "$ndkDir/ndk-build.cmd",
'-C', file('src/main/jni').absolutePath, // Change src/main/jni the relative path to your jni source
'-j', Runtime.runtime.availableProcessors(),
'V=1',
'NDK_DEBUG=1',
'NDK_LIBS_OUT=../jniLibs'
}
}
dependencies {
testCompile 'junit:junit:4.12'
compile 'com.android.support:support-v4:18.0.0'
}