Mercurial > 510Connectbot
diff app/build.gradle @ 447:2907c688955e
add ndk shared object to .apk package
author | Carl Byington <carl@five-ten-sg.com> |
---|---|
date | Thu, 17 Mar 2016 13:24:58 -0700 |
parents | ced663d2e957 |
children | 7492d2cb7b75 |
line wrap: on
line diff
--- a/app/build.gradle Mon Jan 04 16:38:16 2016 -0800 +++ b/app/build.gradle Thu Mar 17 13:24:58 2016 -0700 @@ -1,18 +1,64 @@ +task copyDebugLibTask(type: Copy) { + from 'build/intermediates/binaries/debug/arm/lib/armeabi' + into 'src/main/jniLibs/armeabi' +} +task copyReleaseLibTask(type: Copy) { + from 'build/intermediates/binaries/release/arm/lib/armeabi' + into 'src/main/jniLibs/armeabi' +} + tasks.whenTaskAdded { task -> - if (task.name.contains("lint")) { - task.enabled = false + if (task.name.contains("merge") && task.name.contains("JniLibFolders")) { + if (task.name.contains("ArmDebug")) { + task.dependsOn copyDebugLibTask + } + if (task.name.contains("ArmRelease")) { + task.dependsOn copyReleaseLibTask + } } } + apply plugin: 'com.android.model.application' model { - def signConf - android { compileSdkVersion = 16 buildToolsVersion = "23.0.2" - + buildTypes { + release { + minifyEnabled = false + signingConfig = $("android.signingConfigs.release") + } + debug { + debuggable = true + ndk { + debuggable = true + } + } + } + productFlavors { + create("arm") { + ndk.abiFilters.add("armeabi") + } + create("x86") { + ndk.abiFilters.add("x86") + } + } + ndk { + moduleName = "com_google_ase_Exec" + cppFlags.add("-Werror") + ldLibs.add("log") + } + sources { + main { + jni { + source { + srcDir "Exec" + } + } + } + } defaultConfig.with { applicationId = "com.five_ten_sg.connectbot" minSdkVersion.apiLevel = 8 @@ -20,29 +66,8 @@ } } - compileOptions.with { - sourceCompatibility = JavaVersion.VERSION_1_7 - targetCompatibility = JavaVersion.VERSION_1_7 - } - - android.ndk { - moduleName = "com_google_ase_Exec" - cppFlags.add("-Werror") - ldLibs.add("log") - } - - android.sources { - main { - jni { - source { - srcDir "Exec" - } - } - } - } - android.signingConfigs { - create("signed") { + create("release") { def console = System.console() if (console) { storePassword = new String(console.readPassword("\nkey store password: ")) @@ -58,28 +83,6 @@ storeFile = file("../510Connectbot.keystore") storeType = "jks" keyAlias = "510Connectbot" - signConf = it } } - - android.buildTypes { - release { - minifyEnabled = false - signingConfig = signConf - //proguardFiles.add(file('proguard-rules.txt')) - } - debug { - debuggable = true - } - } - - android.productFlavors { - create("arm") { - ndk.abiFilters.add("armeabi") - } - create("x86") { - ndk.abiFilters.add("x86") - } - } - }