From 96daf3accf4a977ba14704cd832766df5a24e3a6 Mon Sep 17 00:00:00 2001 From: Daniele Date: Wed, 3 Jul 2019 22:02:40 +0200 Subject: [PATCH] Updated instructions, dependencies and configurations for gradle 4.4. --- android/BUILD.txt | 10 ++++-- android/Hin2n/app/build.gradle | 36 +++++++++---------- android/Hin2n/build.gradle | 4 ++- .../gradle/wrapper/gradle-wrapper.properties | 4 +-- 4 files changed, 29 insertions(+), 25 deletions(-) diff --git a/android/BUILD.txt b/android/BUILD.txt index 1515b45..52b9a9f 100644 --- a/android/BUILD.txt +++ b/android/BUILD.txt @@ -1,6 +1,12 @@ - Install jdk. -- Generate app keystore by commond keytool -genkey -alias Hin2n -keystore Hin2n.jks. And remember these two passwords. -- Move Hin2n.jks to android/Hin2n/app directory. We will use this file to sign the application. +- Generate app keystore by commond keytool -genkey -alias Hin2n -keystore Hin2n.jks. And remember these two passwords: + + keytool -genkey -dname "CN=Unknown,O=Unknown,C=Unknown" -keystore Hin2n.jks -keysize 1024 -alias Hin2nalias -validity 14000 -keypass yourpassword -storepass yourpassword + +- Move Hin2n.jks to android/Hin2n/app directory. We will use this file to sign the application +- In the file app/build.gradle replace "yourpassword" with the password used to generate the keystore. + + - Download android tools from https://developer.android.com/, and unzip it. - Install android development environment. diff --git a/android/Hin2n/app/build.gradle b/android/Hin2n/app/build.gradle index a22710f..54a3247 100644 --- a/android/Hin2n/app/build.gradle +++ b/android/Hin2n/app/build.gradle @@ -18,7 +18,7 @@ def getVersionCode = { -> def getVersionName = { -> def ver = 'v0.5.2' - return ver + return ver; try { def stdout = new ByteArrayOutputStream() exec { @@ -28,7 +28,7 @@ def getVersionName = { -> return stdout.toString().trim() } catch (ignored) { - return null + return null; } } @@ -49,7 +49,7 @@ def getEnvOrConsole = { env, prompt -> android { compileSdkVersion 25 - buildToolsVersion '25.0.0' + buildToolsVersion '27.0.3' defaultConfig { applicationId "wang.switchy.hin2n" minSdkVersion 14 @@ -73,9 +73,9 @@ android { release { storeFile file("Hin2n.jks") - storePassword getEnvOrConsole("HIN2N_KSTOREPWD", "Keystore password") - keyAlias "Hin2n" - keyPassword getEnvOrConsole("HIN2N_KEYPWD", "Key password") + storePassword "yourpassword" + keyAlias "Hin2nalias" + keyPassword "yourpassword" } } @@ -97,7 +97,7 @@ android { } applicationVariants.all { variant -> - variant.outputs.each { output -> + variant.outputs.all { output -> def outputFile = output.outputFile def fileName = null if (outputFile != null && outputFile.name.endsWith('.apk')) { @@ -105,7 +105,7 @@ android { def channel = variant.mergedFlavor.manifestPlaceholders.CHANNEL_VALUE def arch = variant.mergedFlavor.manifestPlaceholders.ARCH fileName = "hin2n_${variant.mergedFlavor.versionName}_${channel}_${arch}_${variant.buildType.name}.apk" - output.outputFile = new File(output.outputFile.parent, fileName) + outputFileName = fileName } } } @@ -133,11 +133,7 @@ android { } } - externalNativeBuild { - cmake { - path "CMakeLists.txt" - } - } + } greendao { @@ -147,14 +143,14 @@ greendao { } dependencies { - compile fileTree(include: ['*.jar'], dir: 'libs') - androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', { + implementation fileTree(include: ['*.jar'], dir: 'libs') + androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', { exclude group: 'com.android.support', module: 'support-annotations' }) - compile 'com.android.support:design:25.2.0' - testCompile 'junit:junit:4.12' - compile 'com.android.support:appcompat-v7:25.+' - compile 'org.greenrobot:eventbus:3.1.1' + implementation 'com.android.support:design:25.4.0' + testImplementation 'junit:junit:4.12' + implementation 'com.android.support:appcompat-v7:25.+' + implementation 'org.greenrobot:eventbus:3.1.1' - compile 'org.greenrobot:greendao:3.2.0' + implementation 'org.greenrobot:greendao:3.2.0' } diff --git a/android/Hin2n/build.gradle b/android/Hin2n/build.gradle index 27b30d8..ce7c57d 100644 --- a/android/Hin2n/build.gradle +++ b/android/Hin2n/build.gradle @@ -3,9 +3,10 @@ buildscript { repositories { jcenter() + google() } dependencies { - classpath 'com.android.tools.build:gradle:2.2.2' + classpath 'com.android.tools.build:gradle:3.1.3' classpath 'org.greenrobot:greendao-gradle-plugin:3.1.0' // NOTE: Do not place your application dependencies here; they belong @@ -17,6 +18,7 @@ allprojects { repositories { jcenter() mavenCentral() + google() } } diff --git a/android/Hin2n/gradle/wrapper/gradle-wrapper.properties b/android/Hin2n/gradle/wrapper/gradle-wrapper.properties index b147b4b..1cec6bc 100644 --- a/android/Hin2n/gradle/wrapper/gradle-wrapper.properties +++ b/android/Hin2n/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ -#Tue Apr 17 00:25:58 CST 2018 +#Wed Apr 18 23:44:31 CST 2018 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip