Created
February 19, 2015 17:20
-
-
Save chesnerdesir/a867708a037c83ad685b to your computer and use it in GitHub Desktop.
NDK configuration, default folders and paths
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.apache.tools.ant.taskdefs.condition.Os | |
buildscript { | |
repositories { | |
jcenter() | |
} | |
dependencies { | |
classpath 'com.android.tools.build:gradle:0.13.0' | |
} | |
} | |
apply plugin: 'com.android.application' | |
repositories { | |
jcenter() | |
} | |
android { | |
compileSdkVersion 21 | |
buildToolsVersion "21.1.1" | |
defaultConfig { | |
applicationId "com.example.myappgradle.app" | |
minSdkVersion 9 | |
targetSdkVersion 19 | |
versionCode 1 | |
versionName "1.0" | |
} | |
buildTypes { | |
release { | |
runProguard false | |
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' | |
} | |
} | |
sourceSets { | |
main{ | |
jniLibs.srcDir 'src/main/libs' | |
//jniLibs | |
//jni.srcDirs 'src/main/jni' | |
} | |
} | |
} | |
task ndkBuild(type: Exec,description: 'Compile JNI source via NDK'){ | |
println('executing ndkBuild') | |
//read local.properties file | |
def ndkBuildPath = project.plugins.findPlugin('com.android.application').getNdkFolder().absolutePath + File.separator | |
//or com.android.library | |
if (Os.isFamily(Os.FAMILY_WINDOWS)) { | |
ndkBuildPath +='ndk-build.cmd' | |
} else { | |
ndkBuildPath +='ndk-build' | |
} | |
commandLine ndkBuildPath, '-C', file('src/main/jni').absolutePath | |
//'NDK_PROJECT_PATH=build','APP_BUILD_SCRIPT=src/main/jni/Android.mk'//force using appropriate Makefile | |
} | |
tasks.withType(JavaCompile){ | |
compileTask -> compileTask.dependsOn ndkBuild | |
} | |
dependencies { | |
compile fileTree(dir: 'libs', include: ['*.jar']) | |
compile 'com.android.support:appcompat-v7:21.0.3' | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment