我下载了探戈C例子并在Android中打开了点云jni示例。我安装了ndk,并将ndk.dir=E:\Android\sdk\ndk-bundle添加到我的local.properties文件中。Gradle同步没有错误,但是当我运行时,我得到了这个错误:
错误:任务执行失败“:app:ndkBuild”。启动进程‘命令’E:\Android\sdk\ndk-bundle/ndk-build‘时出现问题。
运动跟踪-jni-示例和hello-探戈-jni-示例也有相同的错误,我也假设其他的错误。
我做错了什么?
build.gradle (app):
apply plugin: 'com.android.application'
android {
compileSdkVersion 19
buildToolsVersion "21.1.2"
defaultConfig {
applicationId "com.projecttango.experiments.nativepointcloud"
minSdkVersion 19
targetSdkVersion 19
}
sourceSets.main {
jniLibs.srcDir 'src/main/libs'
jni.srcDirs = [];
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}
tasks.withType(JavaCompile) {
compileTask -> compileTask.dependsOn ndkBuild
}
task ndkBuild(type: Exec) {
Properties properties = new Properties()
properties.load(project.rootProject.file('local.properties').newDataInputStream())
def ndkbuild = properties.getProperty('ndk.dir', null)+"/ndk-build"
commandLine ndkbuild, '-C', file('src/main/jni').absolutePath
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
}
build.gradle (项目):
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.1.0'
}
}
allprojects {
repositories {
jcenter()
}
}
我的系统:
Windows 8.1 64 bit
Android Studio 1.3 (AI-141.2117773)
NDK r10e extracted to E:\Android\sdk\ndk-bundle
Device: Project Tango Tablet with Schur core
发布于 2015-08-04 17:55:35
您需要将'.cmd‘附加到ndkbuild命令中。我的意思是这条线
def ndkbuild = properties.getProperty('ndk.dir', null)+"/ndk-build"
应改为
def ndkbuild = properties.getProperty('ndk.dir', null)+"/ndk-build.cmd"
这不是你自己的错,我在我的Surface上编译时注意到了同样的问题。
https://stackoverflow.com/questions/31708680
复制相似问题