Last active
December 16, 2015 17:29
-
-
Save ethankhall/5470680 to your computer and use it in GitHub Desktop.
Using Gradle with the Android plugin to add a JNI project to the APK.
This file contains 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.3' | |
} | |
} | |
sourceCompatibility = JavaVersion.VERSION_1_6 | |
targetCompatibility = JavaVersion.VERSION_1_6 | |
repositories { | |
mavenCentral() | |
} | |
//apply plugin: 'java' | |
apply plugin: 'android' | |
android { | |
compileSdkVersion 17 | |
defaultConfig { | |
versionCode = 1 | |
versionName = "0.0" | |
} | |
} | |
task wrapper(type: org.gradle.api.tasks.wrapper.Wrapper) { | |
gradleVersion = '1.4' | |
} | |
dependencies{ | |
compile project(":subProject:jni") | |
} |
This file contains 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
include ':subProject:jni' |
This file contains 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.3' | |
} | |
} | |
sourceCompatibility = JavaVersion.VERSION_1_6 | |
targetCompatibility = JavaVersion.VERSION_1_6 | |
//apply plugin: 'java' | |
apply plugin: 'android-library' | |
//apply plugin: 'android' | |
android { | |
compileSdkVersion 17 | |
defaultConfig { | |
versionCode = 1 | |
versionName = "0.0" | |
} | |
} | |
repositories { | |
mavenCentral() | |
} | |
dependencies{ | |
} | |
task wrapper(type: org.gradle.api.tasks.wrapper.Wrapper) { | |
gradleVersion = '1.4' | |
} | |
task copyNativeLibs(type: Copy) { | |
from fileTree(dir: 'libs', include: '**/*.so' ) | |
into 'build/native-libs' | |
} | |
tasks.withType(Compile) { compileTask -> compileTask.dependsOn copyNativeLibs } | |
clean.dependsOn 'cleanCopyNativeLibs' | |
tasks.withType(com.android.build.gradle.tasks.PackageApplication) { pkgTask -> | |
pkgTask.jniDir new File('build/native-libs') | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment