没有mavlink / build / libs libs文件也不存在ndk-libs.jar也不存在!我怎么解决这个问题?我改变了路径,路径也正确我认为但是我做了sdk配置和同步,清理项目重建项目仍然存在同样的错误。有人可以帮忙吗?
这是我的local.properties文件代码
ndk.dir=C\:\\Users\\X\\AppData\\Local\\Android\\Sdk\\ndk-bundle
sdk.dir=C\:\\Users\\X\\AppData\\Local\\Android\\Sdk
gst.dir=C\:\\Users\\X\\Desktop\\gstolayi
这是我的build.gradle模块:mavlink
apply plugin: 'com.android.library'
android {
compileSdkVersion 27
buildToolsVersion '27.0.3'
defaultConfig {
minSdkVersion 21
targetSdkVersion 27
versionCode 1
versionName '1.0'
ndk{
moduleName 'mavlink_native'
}
}
sourceSets{
main{
jni.srcDirs=[]
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_6
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
productFlavors {
}
compileOptions{
sourceCompatibility JavaVersion.VERSION_1_6
targetCompatibility JavaVersion.VERSION_1_6
}
}
tasks.withType(Exec){
environment['PATH']=System.getenv('PATH')+':/usr/local/bin'
def ndkDir = System.getenv('NDK_HOME')
if (ndkDir == null){
def localProperties = new Properties()
localProperties.load(project.rootProject.file('local.properties').newDataInputStream())
ndkDir = localProperties.getProperty('ndk.dir')
}
if (ndkDir == null){
throw new GradleException('no NDK_SDK directory specified, Add ndk.dir=<PATH_TO_NDK> to local.properties or define NDK_HOME environment variable')
}
environment['NDK_HOME']=ndkDir
}
dependencies{
implementation fileTree(dir:'libs',include:['*.jar'])
implementation fileTree(dir:"$buildDir/libs",include:'ndk-libs')
implementation files("$buildDir/libs/ndk-libs.jar")
tasks.withType(JavaCompile){
compileTask -> compileTask.dependsOn ndkLibsToJar
}
task ndkLibsToJar(type:Zip,dependsOn:'ndkBuild',description:'create a jar of the native libs'){
destinationDir new File(buildDir,'libs')
baseName 'ndk-libs'
extension 'jar'
from(new File(buildDir,'libs')){
include '**/*.so'
}
into'lib/'
}
task ndkBuild (type:Exec,description:'compile JNI source via NDK'){
commandLine environment['NDK_HOME']+'/ndk-build','NDK_PROJECT_PATH=build','APP_BUILD_SCRIPT=src/main/jni/Android.mk',
'NDK_APPLICATION_MK=src/main/jni/Application.mk'
}
implementation project(':threadwrapper')
implementation project(':connectionlistener')
}