方法一:
1.在src/main中新建jniLibs文件夹 ,把.so复制进去即可
方法二:
1.在app/中新建libs文件夹,把.so复制进去
2.在app/build.gradle中添加以下五行脚本即可(注:以下脚本意思是会把libs文件夹当成jniLibs文件夹,可以直接用so库了)
sourceSets {
main {
jniLibs.srcDirs = ['libs']
}
}
贴上完整的app/build.gradle文件,红色的部分是新增的
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "com.tofu.chat"
minSdkVersion 16
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
sourceSets {
main {
jniLibs.srcDirs = ['libs']
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.1.1'
compile project(':common')
compile files('libs/kandy-1.6.244.jar')
}