如何修复“ CreateProcess错误= 2,系统找不到指定的文件”

时间:2019-07-12 13:55:08

标签: java android-studio

我已经运行了一个l2tp vpn源代码,并且gradle已成功同步。但是当我想在android上运行或单击“重建”或“清理”项目时,Gradle会显示此错误。 我该如何解决?请帮我 。

android { compileSdkVersion 26
defaultConfig {
        applicationId "org.strongswan.proxy"
        minSdkVersion 19
        targetSdkVersion 26
        versionCode 64
        versionName "2.1.1"
    }

    sourceSets.main {
        jni.srcDirs = [] // disables the default ndk-build call (with on-the-fly Android.mk files)
        jniLibs.srcDir 'src/main/libs'
    }

    task buildNative(type: Exec) {
        workingDir 'src/main/jni'
        commandLine "G:/programs/SDKManager/android-sdk-windows/ndk-bundle/ndk-build", '-j', Runtime.runtime.availableProcessors()
    }

    task cleanNative(type: Exec) {
        workingDir 'src/main/jni'
        commandLine "G:/programs/SDKManager/android-sdk-windows/ndk-bundle/ndk-build", 'clean'
    }

    tasks.withType(JavaCompile) {
        compileTask -> compileTask.dependsOn buildNative
        options.compilerArgs << "-Xlint:unchecked" << "-Xlint:deprecation"
    }

    clean.dependsOn 'cleanNative'

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
        }
    }
    compileOptions {
        targetCompatibility 1.8
        sourceCompatibility 1.8
    }
}

dependencies {
    implementation 'com.android.support:appcompat-v7:26.1.0'
    implementation 'com.android.support:design:26.1.0'
    implementation 'com.android.support:preference-v7:26.1.0'
    implementation 'com.android.support:support-v4:26.1.0'
    testImplementation 'junit:junit:4.12'

}

构建gradle的错误是这样的:

CreateProcess error=2, The system cannot find the file specified

you can see errors here too

0 个答案:

没有答案