Wie verwende ich meine eigene Android.mk-Datei mit Android Sudio?

Ich definiere einige Variablen innerhalb desAndroid.mk -Datei (ich übergebe einige Flags für den Compiler), aber jedes Mal, wenn ich mein Projekt erstelle, wird dasAndroid.mk wird überschrieben. Ich gehe davon aus, dassGradle ist dafür verantwortlich und dass ich dort suchen soll?Wie verwende ich meine eigene Android.mk-Datei?

Hintergrundinformation

Ubuntu 64bit,Android Studio 1.0.1, JDK7. Ich habe mein @ eingewickeNDK Version mit O-LLVM NDK, und als solches bearbeite ich dasAndroid.mk Datei befindet sich beiapp/build/intermediates/ndk/debug (es ist das einzigeAndroid.mk -Datei in meinem Projektverzeichnis), anders als der Speicherort, an dem das Dokument fürO-LLVM gibt Beispiele für.

Auch gibt es keineApplication.mk Datei, also wieder nehme ich an, dassGradle ist für die Aufrufe des Compilers verantwortlich?

Jede Hilfe wäre sehr dankbar.

Kyl

Aktualisierte Informatio

build.gradle - (app)

//The following code until the "----" line is the new build.gradle config file
// that disables automatic Android.mk file generation

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

android {

    compileSdkVersion 21
    buildToolsVersion "21.1.2"

    defaultConfig {
        applicationId "com.md.helloworld"
        minSdkVersion 15
        targetSdkVersion 21
        versionCode 1
        versionName "1.0"
        ndk {
            moduleName "MyLib"
        }
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }

    sourceSets.main {
        jniLibs.srcDir 'src/main/libs' //set libs as .so's location instead of jni
        jni.srcDirs = [] //disable automatic ndk-build call with auto-generated Android.mk file
    }

    // Call regular ndk-build (.cmd) script from the app directory
    task ndkBuild(type: Exec) {
        commandLine 'ndk-build', '-C', file('src/main/').absolutePath
    }

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

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:appcompat-v7:21.0.3'
}

/*
//The following code is the original Android.mk file

apply plugin: 'com.android.application'

android {
    compileSdkVersion 21
    buildToolsVersion "21.1.2"

    defaultConfig {
        applicationId "com.md.helloworld"
        minSdkVersion 15
        targetSdkVersion 21
        versionCode 1
        versionName "1.0"
        //The only modified line
        ndk {
            moduleName "MyLib"
        }
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:appcompat-v7:21.0.3'
}
*/

Android.mk

LOCAL_PATH := $(call my-dir)

include $(CLEAR_VARS)

LOCAL_MODULE    := helloWorld
LOCAL_SRC_FILES := main.c

LOCAL_LDLIBS := -static

include $(BUILD_EXECUTABLE)

Application.mk

LOCAL_PATH := $(call my-dir)

include $(CLEAR_VARS)

APP_ABI := armeabi

NDK_TOOLCHAIN_VERSION := clang3.4-obfuscator

include $(BUILD_EXECUTABLE)

Bitte beachten Sie: Ich übergebe noch keine Cflags. Ich versuche zuerst, einen Vanilla-Build zum Laufen zu bringen.

Antworten auf die Frage(2)

Ihre Antwort auf die Frage