changeset 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 5ce5235adde6
children df509fd900ba
files app/build.gradle app/src/main/AndroidManifest.xml build.gradle
diffstat 3 files changed, 53 insertions(+), 52 deletions(-) [+]
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")
-        }
-    }
-
 }
--- a/app/src/main/AndroidManifest.xml	Mon Jan 04 16:38:16 2016 -0800
+++ b/app/src/main/AndroidManifest.xml	Thu Mar 17 13:24:58 2016 -0700
@@ -43,7 +43,6 @@
 	<supports-screens />
 
 	<application
-        android:debuggable="true"
 		android:icon="@drawable/icon"
 		android:label="@string/app_name"
 		android:description="@string/app_desc"
--- a/build.gradle	Mon Jan 04 16:38:16 2016 -0800
+++ b/build.gradle	Thu Mar 17 13:24:58 2016 -0700
@@ -5,8 +5,7 @@
         jcenter()
     }
     dependencies {
-        //classpath 'com.android.tools.build:gradle:1.5.0'
-        classpath 'com.android.tools.build:gradle-experimental:0.4.0'
+        classpath 'com.android.tools.build:gradle-experimental:0.7.0-alpha3'
     }
 }