当我尝试运行我的android项目时,我收到以下stacktrace错误。
错误:java.io.IOException:CreateProcess error = 2,系统找不到指定的文件 错误:java.io.IOException:无法运行程序“E:\ android-ndk-r14-windows-x86_64 \ android-ndk-r14 / ndk-build”(在目录“G:\ downloads \ WritePadSDK-master \ Android \” sample_astudio \ app“):CreateProcess error = 2,系统找不到指定的文件 错误:net.rubygrapefruit.platform.NativeException:无法启动'E:\ android-ndk-r14-windows-x86_64 \ android-ndk-r14 / ndk-build' 错误:org.gradle.process.internal.ExecException:启动进程'命令'时发生问题E:\ android-ndk-r14-windows-x86_64 \ android-ndk-r14 / ndk-build'' 信息:Gradle任务[:app:assembleDebug]
下面的部分是我的gradle代码,其中包括ndk
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/'
}
// TODO: to reduce jar size, replace APP_ABI=all with list list of CPUs you want to support
task ndkBuild(type: Exec, description: 'Compile JNI source via NDK') {
def ndkDir = plugins.getPlugin('com.android.application').sdkHandler.getNdkFolder() // '/Android/android-ndk'
commandLine "$ndkDir/ndk-build", 'APP_ABI=all', 'APP_OPTIM=release',
'NDK_PROJECT_PATH=build',
'APP_BUILD_SCRIPT=src/main/jni/Android.mk'
}
提前致谢