Java 如何在Android中使用.so文件 我想在我的Android项目中添加一个C++库,但是我一直在得到错误: Could not get unknown property 'jniLibs' for source set 'main' of type org.gradle.api.internal.tasks.DefaultSourceSet.
该项目试图使用SQLite()的.so库 如何在项目中包含.so库并成功链接它以调用其函数 提前谢谢大家 我的身材。格拉德尔Java 如何在Android中使用.so文件 我想在我的Android项目中添加一个C++库,但是我一直在得到错误: Could not get unknown property 'jniLibs' for source set 'main' of type org.gradle.api.internal.tasks.DefaultSourceSet.,java,android,c++,c,sqlite,Java,Android,C++,C,Sqlite,该项目试图使用SQLite()的.so库 如何在项目中包含.so库并成功链接它以调用其函数 提前谢谢大家 我的身材。格拉德尔 apply plugin: 'com.android.library' android { compileSdkVersion 26 defaultConfig { minSdkVersion 15 targetSdkVersion 26 versionCode 1 versionName
apply plugin: 'com.android.library'
android {
compileSdkVersion 26
defaultConfig {
minSdkVersion 15
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
productFlavors {
}
buildToolsVersion '27.0.3'
externalNativeBuild {
cmake {
path 'CMakeLists.txt'
}
}
sourceSets {
main {
jniLibs.srcDirs = ['src/main/jniLibs']
}
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:26.+'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
}
sourceSets {
main {
jniLibs.srcDirs = ['src/main/jniLibs']
}
}
sourceSets {
main {
jniLibs.srcDir(['src/main/jniLibs'])
}
}
app/src/main/jniLibs
中李>
谢谢您的回复@xingjiu。这样我就得到了错误:
无法列出“/project/src/main/jniLibs/libsqlite3.so”的内容。无法跟踪符号链接代码>能否请您提供建议。一个纯干净的构建可能会有所帮助,符号链接总是由一些中间编译文件引起的。