Last active
June 1, 2018 02:48
-
-
Save dweinstein/7528167 to your computer and use it in GitHub Desktop.
Gradle build files for Android native library development
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
buildscript { | |
repositories { | |
mavenCentral() | |
} | |
dependencies { | |
classpath 'com.android.tools.build:gradle:0.6.+' | |
} | |
} | |
apply plugin: 'android' | |
repositories { | |
mavenCentral() | |
} | |
android { | |
compileSdkVersion 18 | |
buildToolsVersion "18.0.1" | |
defaultConfig { | |
minSdkVersion 7 | |
targetSdkVersion 19 | |
} | |
} | |
dependencies { | |
compile 'com.android.support:appcompat-v7:+' | |
compile fileTree(dir: 'libs', include: '*.jar') | |
} | |
task packageNativeLibs_ARM(type: Jar) { | |
baseName 'libtestlib' | |
classifier 'armeabi' | |
from(file('libs/armeabi/')) { | |
include '**/*.so' | |
} | |
into('lib/armeabi') | |
destinationDir(file('libs/')) | |
} | |
task packageNativeLibs_x86(type: Jar) { | |
baseName 'libtestlib' | |
classifier 'x86' | |
from(file('libs/x86/')) { | |
include '**/*.so' | |
} | |
into('lib/x86') | |
destinationDir(file('libs/')) | |
} | |
task packageNativeLibs(description: "package native libraries") { | |
} | |
packageNativeLibs.dependsOn 'packageNativeLibs_ARM' | |
packageNativeLibs.dependsOn 'packageNativeLibs_x86' | |
task ndkBuild(type: Exec, description: "Task to run ndk-build") { | |
commandLine ndkDir + '/ndk-build' | |
} | |
packageNativeLibs.dependsOn 'ndkBuild' | |
tasks.withType(JavaCompile) { compileTask -> compileTask.dependsOn packageNativeLibs } | |
clean.dependsOn 'cleanPackageNativeLibs' | |
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
# properties file | |
# set your NDK code path here: | |
ndkDir=/Users/user/android-ndk |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment