Browse Source

Merge pull request #158 from daniele-sartiano/dev

Updated instructions, dependencies and configurations for gradle 4.4.
pull/166/head
Luca Deri 5 years ago
committed by GitHub
parent
commit
593bde7944
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 10
      android/BUILD.txt
  2. 36
      android/Hin2n/app/build.gradle
  3. 4
      android/Hin2n/build.gradle
  4. 4
      android/Hin2n/gradle/wrapper/gradle-wrapper.properties

10
android/BUILD.txt

@ -1,6 +1,12 @@
- Install jdk. - Install jdk.
- Generate app keystore by commond keytool -genkey -alias Hin2n -keystore Hin2n.jks. And remember these two passwords. - 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.
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. - Download android tools from https://developer.android.com/, and unzip it.
- Install android development environment. - Install android development environment.

36
android/Hin2n/app/build.gradle

@ -18,7 +18,7 @@ def getVersionCode = { ->
def getVersionName = { -> def getVersionName = { ->
def ver = 'v0.5.2' def ver = 'v0.5.2'
return ver return ver;
try { try {
def stdout = new ByteArrayOutputStream() def stdout = new ByteArrayOutputStream()
exec { exec {
@ -28,7 +28,7 @@ def getVersionName = { ->
return stdout.toString().trim() return stdout.toString().trim()
} }
catch (ignored) { catch (ignored) {
return null return null;
} }
} }
@ -49,7 +49,7 @@ def getEnvOrConsole = { env, prompt ->
android { android {
compileSdkVersion 25 compileSdkVersion 25
buildToolsVersion '25.0.0' buildToolsVersion '27.0.3'
defaultConfig { defaultConfig {
applicationId "wang.switchy.hin2n" applicationId "wang.switchy.hin2n"
minSdkVersion 14 minSdkVersion 14
@ -73,9 +73,9 @@ android {
release { release {
storeFile file("Hin2n.jks") storeFile file("Hin2n.jks")
storePassword getEnvOrConsole("HIN2N_KSTOREPWD", "Keystore password") storePassword "yourpassword"
keyAlias "Hin2n" keyAlias "Hin2nalias"
keyPassword getEnvOrConsole("HIN2N_KEYPWD", "Key password") keyPassword "yourpassword"
} }
} }
@ -97,7 +97,7 @@ android {
} }
applicationVariants.all { variant -> applicationVariants.all { variant ->
variant.outputs.each { output -> variant.outputs.all { output ->
def outputFile = output.outputFile def outputFile = output.outputFile
def fileName = null def fileName = null
if (outputFile != null && outputFile.name.endsWith('.apk')) { if (outputFile != null && outputFile.name.endsWith('.apk')) {
@ -105,7 +105,7 @@ android {
def channel = variant.mergedFlavor.manifestPlaceholders.CHANNEL_VALUE def channel = variant.mergedFlavor.manifestPlaceholders.CHANNEL_VALUE
def arch = variant.mergedFlavor.manifestPlaceholders.ARCH def arch = variant.mergedFlavor.manifestPlaceholders.ARCH
fileName = "hin2n_${variant.mergedFlavor.versionName}_${channel}_${arch}_${variant.buildType.name}.apk" 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 { greendao {
@ -147,14 +143,14 @@ greendao {
} }
dependencies { dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs') implementation fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', { androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations' exclude group: 'com.android.support', module: 'support-annotations'
}) })
compile 'com.android.support:design:25.2.0' implementation 'com.android.support:design:25.4.0'
testCompile 'junit:junit:4.12' testImplementation 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:25.+' implementation 'com.android.support:appcompat-v7:25.+'
compile 'org.greenrobot:eventbus:3.1.1' implementation 'org.greenrobot:eventbus:3.1.1'
compile 'org.greenrobot:greendao:3.2.0' implementation 'org.greenrobot:greendao:3.2.0'
} }

4
android/Hin2n/build.gradle

@ -3,9 +3,10 @@
buildscript { buildscript {
repositories { repositories {
jcenter() jcenter()
google()
} }
dependencies { 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' classpath 'org.greenrobot:greendao-gradle-plugin:3.1.0'
// NOTE: Do not place your application dependencies here; they belong // NOTE: Do not place your application dependencies here; they belong
@ -17,6 +18,7 @@ allprojects {
repositories { repositories {
jcenter() jcenter()
mavenCentral() mavenCentral()
google()
} }
} }

4
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 distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists 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

Loading…
Cancel
Save