当使用gradle时,添加.so和jar包遇到报错:
java.lang.UnsatisfiedLinkError: Couldn‘t load faceppapi: findLibrary returned null
解决办法是将build.gradle写成如下形式:
apply plugin: ‘android‘ android { compileSdkVersion 19 buildToolsVersion "19.0.0" defaultConfig { minSdkVersion 16 targetSdkVersion 19 versionCode 1 versionName "1.0" } buildTypes { release { runProguard false proguardFiles getDefaultProguardFile(‘proguard-android.txt‘), ‘proguard-rules.txt‘ } } sourceSets { main { jniLibs.srcDirs = [‘libs‘] } } } dependencies { compile fileTree(dir: ‘libs‘, include: [‘*.jar‘]) }
标红的地方是需要注意的。
参考:
http://blog.csdn.net/qiujuer/article/details/24209457
http://www.tuicool.com/articles/yuAjAz
Android Studio-Gradle项目中添加JNI生成文件(.so文件)
时间: 2024-10-17 10:08:04