我正在使用android studio ndk。我想制作一个JNI的.so,但是这个。所以引用另一个。所以我应该链接到另一个。所以当编译JNI时.so 以下是我的JNITest \ app \ build.gradle
android {
compileSdkVersion 22
buildToolsVersion "22.0.1"
defaultConfig {
applicationId "com.example.administrator.jnitest"
minSdkVersion 15
targetSdkVersion 22
versionCode 1
versionName "1.0"
ndk {
moduleName "JniTest"
ldLibs "log", "z", "m" ,"netsdk", "rtspclient" , "osl"
abiFilters "armeabi", "armeabi-v7a", "x86"
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:22.1.1'
}
“netsdk”,“rtspclient”,“osl”是依赖共享库,我不知道如何将.so路径添加到它们和ndk报告现在的许多非引用
答案 0 :(得分:0)
gradle DSL支持 ldFlags ,例如
ldFlags += "-L<path-to-libs>"
此外,您应该指示Android Studio将第三方库包装到APK中:
jniLibs.srcDirs = "<path-to-libs>"