Reputation: 925
I'm developing certain sdk to provider some features for other android apps. One library project of my sdk project dependencies has some .so lib files. When assembling my sdk project to aar package with gradle, I found that the .so files are not included. How to assemble .so lib files into aar package?
Here is the build.gradle of the sdk project:
apply plugin: 'com.android.library'
android {
signingConfigs {
debug {
keyAlias 'debug.keystore'
keyPassword 'ssdebug'
storeFile file('release-tools/debug.keystore')
storePassword 'ssdebug'
}
release {
keyAlias 'release.keystore'
keyPassword 'dddd'
storeFile file('../seedstore/release.keystore')
storePassword 'dddd'
}
}
compileSdkVersion 22
buildToolsVersion "22.0.1"
defaultConfig {
minSdkVersion 16
targetSdkVersion 22
signingConfig signingConfigs.release
}
sourceSets {
main {
jniLibs.srcDir file('jni/')
}
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.release
}
debug {
signingConfig signingConfigs.debug
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
productFlavors {
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:22.2.1'
compile project(':alisdk')
compile project(':jdsdk')
}
Upvotes: 5
Views: 3243
Reputation: 925
Another easier solution, add the following statements under module build.gradle:
buildTypes {
debug {
ndk {
abiFilters 'armeabi'
}
}
release {
ndk {
abiFilters 'armeabi'
}
}
}
Upvotes: 0
Reputation:
I just did exactly same thing after thousand times trying, finally go through. -
//notes: I had tried to add *.so file into a xxx.jar, add it under module's libs , add its compile dependence. The .aar had packaged it into libs. However, when the user use this .aar, there is link error for the native function call.
Upvotes: 1