2016-05-12 16 views
4

Ich benutze die neueste Android Studio Build 1.5, da ich ein Eclipse-Projekt importieren möchten, das NDK benötigt. Mein Projekt funktioniert. Aber wenn ich APK gebaut, ist es Fehler machen:Android Studio NDK Fehler beim Erstellen Fehler: Ausführung fehlgeschlagen für Aufgabe ': app: compileReleaseNdk'

Error:Execution failed for task ':app:compileReleaseNdk'. 
> A problem occurred starting process 'command 'C:\Users\Android\AppData\Local\Android\sdk\ndk-bundle\ndk-build.cmd'' 

Mein build.gradle:

apply plugin: 'com.android.application' 
import org.apache.tools.ant.taskdefs.condition.Os 

android { 
    compileSdkVersion 23 
    buildToolsVersion "23.0.2" 

    defaultConfig { 
     applicationId "vaeapp.gamecard.vn" 
     minSdkVersion 14 
     targetSdkVersion 19 
     multiDexEnabled = true 
     versionCode 4 
     versionName "1.3.4" 

     ndk { 
      moduleName "gc" 
     } 
    } 
    // call regular ndk-build(.cmd) script from app directory 
    task ndkBuild(type: Exec) { 
     if (Os.isFamily(Os.FAMILY_WINDOWS)) { 
      commandLine 'ndk-build.cmd', '-C', file('src/main').absolutePath 
     } else { 
      commandLine 'ndk-build', '-C', file('src/main').absolutePath 
     } 
    } 

    repositories { 
     jcenter() 
     maven { url "https://jitpack.io" } 
    } 
    buildTypes { 
     release { 
      minifyEnabled false 
      proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 
     } 
    } 
} 

dependencies { 
    //compile fileTree(dir: 'libs', include: ['*.jar']) 
    testCompile 'junit:junit:4.12' 
    compile 'com.android.support:multidex:1.0.1' 
    compile 'com.android.support:appcompat-v7:23.2.0' 
    compile 'com.google.code.gson:gson:2.2.4' 
    compile 'org.jbundle.util.osgi.wrapped:org.jbundle.util.osgi.wrapped.org.apache.http.client:4.1.2' 
    compile 'com.facebook.android:facebook-android-sdk:4.2.0' 
    // compile 'com.android.support:appcompat-v7:20.0.0' 
// compile 'com.google.android.gms:play-services:+' 
    compile 'com.google.android.gms:play-services:4.0.30' 
    compile files('libs/activation.jar') 
    compile files('libs/additionnal.jar') 
    compile files('libs/commons-io-2.4.jar') 
    compile files('libs/error-reporter.jar') 
    //compile files('libs/httpclient-4.0.1.jar') 
    compile files('libs/mail.jar') 
    compile files('libs/universal-image-loader-1.9.3.jar') 
    compile fileTree(dir: 'libs', include: 'Parse-*.jar') 
    // compile 'com.parse:parse-android:1.10.1' 
    compile 'com.parse.bolts:bolts-android:1.+' 
    compile 'com.parse:parse-android:1.+' 
} 

Bitte meine fix Fehler helfen. Danke!

+0

siehe meine Antwort unten. –

Antwort

2

Statt mit nur dieses

// call regular ndk-build(.cmd) script from app directory 
    task ndkBuild(type: Exec) { 
     if (Os.isFamily(Os.FAMILY_WINDOWS)) { 
      commandLine 'ndk-build.cmd', '-C', file('src/main').absolutePath 
     } else { 
      commandLine 'ndk-build', '-C', file('src/main').absolutePath 
     } 
    } 

verwenden

// call regular ndk-build(.cmd) script from app directory 
    task ndkBuild(type: Exec) { 
     if (Os.isFamily(Os.FAMILY_WINDOWS)) { 
      commandLine 'ndk-build.cmd', '-C', file('src/main').absolutePath 
     } else { 
      commandLine 'ndk-build', '-C', file('src/main').absolutePath 
     } 
    } 

    tasks.withType(JavaCompile) { 
     compileTask -> compileTask.dependsOn ndkBuild 
    } 
+1

Ich versuche es, aber es ist ein Fehler: Fehler: Ausführung fehlgeschlagen für Task ': app: ndkBuild'. > Ein Problem beim Starten des Prozesses 'Befehl' ndk-build.cmd '' –

+0

@HoangAloevera siehe dies: http://StackOverflow.com/Questions/29738953/ndkbuild-Failure –

+0

@HoangAloevera geben Sie nur den 'ndk-Build' Pfad zu ihm. –

Verwandte Themen