From 6dace959d2dfb8227f1b8b5b2a30b82e9bfbcbc6 Mon Sep 17 00:00:00 2001 From: Mygod Date: Wed, 6 Dec 2017 23:58:11 -0800 Subject: [PATCH 1/4] Split ABIs for smaller apk size --- mobile/build.gradle | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/mobile/build.gradle b/mobile/build.gradle index 1160705c..686a9bfb 100644 --- a/mobile/build.gradle +++ b/mobile/build.gradle @@ -1,3 +1,4 @@ +import com.android.build.OutputFile import java.util.regex.Matcher import java.util.regex.Pattern @@ -19,7 +20,7 @@ android { applicationId "com.github.shadowsocks" minSdkVersion rootProject.minSdkVersion targetSdkVersion rootProject.sdkVersion - versionCode 200 + versionCode 1 versionName "4.4.0" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" vectorDrawables.useSupportLibrary true @@ -37,6 +38,15 @@ android { } lintOptions { abortOnError false + checkReleaseBuilds false + } + splits { + abi { + enable true + reset() + include 'armeabi-v7a', 'arm64-v8a', 'x86' + universalApk false + } } sourceSets.main.jniLibs.srcDirs += new File(project(':core').buildDir, "intermediates/bundles/${getCurrentFlavor()}/jni") @@ -78,3 +88,11 @@ repositories { } apply plugin: 'com.google.gms.google-services' + +ext.abiCodes = ['armeabi-v7a': 1, 'arm64-v8a': 2, x86: 3] +android.applicationVariants.all { variant -> + variant.outputs.each { output -> + def baseAbiVersionCode = project.ext.abiCodes.get(output.getFilter(OutputFile.ABI)) + if (baseAbiVersionCode != null) output.versionCodeOverride = baseAbiVersionCode * 1000 + variant.versionCode + } +} From cd1f94f4a0d667e722d2185e51ba88cd1a39cc4b Mon Sep 17 00:00:00 2001 From: Mygod Date: Thu, 14 Dec 2017 12:26:32 -0800 Subject: [PATCH 2/4] Change version code --- mobile/build.gradle | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mobile/build.gradle b/mobile/build.gradle index 686a9bfb..1251386e 100644 --- a/mobile/build.gradle +++ b/mobile/build.gradle @@ -92,7 +92,7 @@ apply plugin: 'com.google.gms.google-services' ext.abiCodes = ['armeabi-v7a': 1, 'arm64-v8a': 2, x86: 3] android.applicationVariants.all { variant -> variant.outputs.each { output -> - def baseAbiVersionCode = project.ext.abiCodes.get(output.getFilter(OutputFile.ABI)) - if (baseAbiVersionCode != null) output.versionCodeOverride = baseAbiVersionCode * 1000 + variant.versionCode + def offset = project.ext.abiCodes.get(output.getFilter(OutputFile.ABI)) + if (offset != null) output.versionCodeOverride = variant.versionCode * 1000 + offset } } From 4f5ee68f401b05e813a21c5d7fe18816e5d41686 Mon Sep 17 00:00:00 2001 From: Mygod Date: Thu, 18 Jan 2018 22:58:26 -0800 Subject: [PATCH 3/4] Add universalApk --- mobile/build.gradle | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/mobile/build.gradle b/mobile/build.gradle index 6ff0365f..3b204e4b 100644 --- a/mobile/build.gradle +++ b/mobile/build.gradle @@ -21,7 +21,7 @@ android { applicationId "com.github.shadowsocks" minSdkVersion rootProject.minSdkVersion targetSdkVersion rootProject.sdkVersion - versionCode 1 + versionCode 210 versionName "4.4.5" testApplicationId "com.github.shadowsocks.test" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" @@ -43,6 +43,7 @@ android { enable true reset() include 'armeabi-v7a', 'arm64-v8a', 'x86' + universalApk true } } sourceSets.main.jniLibs.srcDirs += @@ -85,6 +86,6 @@ ext.abiCodes = ['armeabi-v7a': 1, 'arm64-v8a': 2, x86: 3] android.applicationVariants.all { variant -> variant.outputs.each { output -> def offset = project.ext.abiCodes.get(output.getFilter(OutputFile.ABI)) - if (offset != null) output.versionCodeOverride = variant.versionCode * 1000 + offset + if (offset != null) output.versionCodeOverride = variant.versionCode + offset } } From 168c0588a6ccc31be5e6a06930c655593bcc02c5 Mon Sep 17 00:00:00 2001 From: Mygod Date: Thu, 18 Jan 2018 23:10:12 -0800 Subject: [PATCH 4/4] Fix debug builds --- mobile/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mobile/build.gradle b/mobile/build.gradle index 3b204e4b..5bc36f16 100644 --- a/mobile/build.gradle +++ b/mobile/build.gradle @@ -83,7 +83,7 @@ repositories { apply plugin: 'com.google.gms.google-services' ext.abiCodes = ['armeabi-v7a': 1, 'arm64-v8a': 2, x86: 3] -android.applicationVariants.all { variant -> +if (getCurrentFlavor() == 'release') android.applicationVariants.all { variant -> variant.outputs.each { output -> def offset = project.ext.abiCodes.get(output.getFilter(OutputFile.ABI)) if (offset != null) output.versionCodeOverride = variant.versionCode + offset