Modify ProGuard rules to automatically shrink object files
This commit is contained in:
parent
14ce085be8
commit
e5018a02d1
8 changed files with 53 additions and 25 deletions
|
@ -191,7 +191,13 @@ android {
|
|||
buildTypes {
|
||||
release {
|
||||
minifyEnabled true
|
||||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules-release.pro'
|
||||
|
||||
proguardFiles getDefaultProguardFile('proguard-android.txt'),
|
||||
'proguard-rules-base.pro',
|
||||
'proguard-rules-bouncycastle.pro',
|
||||
'proguard-rules-okio.pro',
|
||||
'proguard-rules-okhttp.pro',
|
||||
'proguard-rules-support.pro'
|
||||
|
||||
// Reference them in the java files with e.g. BuildConfig.ACCOUNT_TYPE.
|
||||
buildConfigField "String", "ACCOUNT_TYPE", "\"org.sufficientlysecure.keychain.account\""
|
||||
|
@ -207,10 +213,17 @@ android {
|
|||
}
|
||||
|
||||
debug {
|
||||
// disable ProGuard for faster compile times for debug builds
|
||||
minifyEnabled false
|
||||
minifyEnabled true
|
||||
|
||||
multiDexEnabled true
|
||||
proguardFiles = buildTypes.release.proguardFiles
|
||||
|
||||
testProguardFiles getDefaultProguardFile('proguard-android.txt'),
|
||||
'proguard-rules-base.pro',
|
||||
'proguard-rules-bouncycastle.pro',
|
||||
'proguard-rules-okio.pro',
|
||||
'proguard-rules-okhttp.pro',
|
||||
'proguard-rules-support.pro',
|
||||
'proguard-rules-test.pro'
|
||||
|
||||
applicationIdSuffix ".debug"
|
||||
|
||||
|
|
17
OpenKeychain/proguard-rules-base.pro
Normal file
17
OpenKeychain/proguard-rules-base.pro
Normal file
|
@ -0,0 +1,17 @@
|
|||
# Documentation for ProGuard:
|
||||
# http://developer.android.com/guide/developing/tools/proguard.html
|
||||
# http://proguard.sourceforge.net/
|
||||
|
||||
-dontoptimize
|
||||
-dontpreverify
|
||||
|
||||
-dontnote **
|
||||
|
||||
-keepattributes **
|
||||
|
||||
-keep class org.sufficientlysecure.keychain.** { *; }
|
||||
|
||||
# * Obfuscate android.support.v7.view.menu.** to fix Samsung Android 4.2 bug
|
||||
# https://code.google.com/p/android/issues/detail?id=78377
|
||||
# * Disable obfuscation for all other classes
|
||||
-keepnames class !android.support.v7.view.menu.**, ** { *; }
|
3
OpenKeychain/proguard-rules-bouncycastle.pro
Normal file
3
OpenKeychain/proguard-rules-bouncycastle.pro
Normal file
|
@ -0,0 +1,3 @@
|
|||
-keep class org.bouncycastle.jcajce.provider.** { *; }
|
||||
|
||||
-dontwarn javax.naming.**
|
2
OpenKeychain/proguard-rules-okhttp.pro
Normal file
2
OpenKeychain/proguard-rules-okhttp.pro
Normal file
|
@ -0,0 +1,2 @@
|
|||
-dontwarn javax.annotation.Nullable
|
||||
-dontwarn javax.annotation.ParametersAreNonnullByDefault
|
2
OpenKeychain/proguard-rules-okio.pro
Normal file
2
OpenKeychain/proguard-rules-okio.pro
Normal file
|
@ -0,0 +1,2 @@
|
|||
-dontwarn org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement
|
||||
-dontwarn okio.**
|
|
@ -1,21 +0,0 @@
|
|||
# Documentation for ProGuard:
|
||||
# http://developer.android.com/guide/developing/tools/proguard.html
|
||||
# http://proguard.sourceforge.net/
|
||||
|
||||
#-dontshrink # shrinking enabled, see below
|
||||
#-dontobfuscate # obfuscation enabled for one class (see below)
|
||||
-dontoptimize
|
||||
-dontpreverify
|
||||
-keepattributes **
|
||||
-dontwarn **
|
||||
-dontnote **
|
||||
|
||||
# Rules are defined as negation filters!
|
||||
# (! = negation filter, ** = all subpackages)
|
||||
# Keep everything (** {*;}) except...
|
||||
|
||||
# * Obfuscate android.support.v7.view.menu.** to fix Samsung Android 4.2 bug
|
||||
# https://code.google.com/p/android/issues/detail?id=78377
|
||||
# * Remove unneeded Bouncy Castle packages to be under 64K limit
|
||||
# http://developer.android.com/tools/building/multidex.html
|
||||
-keep class !android.support.v7.view.menu.**,!org.bouncycastle.crypto.tls.**,!org.bouncycastle.pqc.**,!org.bouncycastle.x509.**,!org.bouncycastle.jcajce.provider.asymmetric.dstu.**,!org.bouncycastle.jcajce.provider.asymmetric.ecgost.**,!org.bouncycastle.jcajce.provider.asymmetric.gost.**,!org.bouncycastle.jcajce.provider.asymmetric.DSTU4145,!org.bouncycastle.jcajce.provider.asymmetric.ECGOST,!org.bouncycastle.jcajce.provider.asymmetric.GOST,!org.bouncycastle.asn1.cmp.**,!org.bouncycastle.asn1.crmf.**,!org.bouncycastle.asn1.dvcs.**,!org.bouncycastle.asn1.smime.**,!org.bouncycastle.asn1.tsp.**,** {*;}
|
1
OpenKeychain/proguard-rules-support.pro
Normal file
1
OpenKeychain/proguard-rules-support.pro
Normal file
|
@ -0,0 +1 @@
|
|||
-keep class android.support.v7.widget.SearchView { *; }
|
11
OpenKeychain/proguard-rules-test.pro
Normal file
11
OpenKeychain/proguard-rules-test.pro
Normal file
|
@ -0,0 +1,11 @@
|
|||
-dontwarn android.test.**
|
||||
-dontwarn com.android.support.test.**
|
||||
-dontwarn android.databinding.**
|
||||
-dontwarn javax.annotation.**
|
||||
|
||||
-dontwarn org.hamcrest.**
|
||||
-dontwarn org.junit.**
|
||||
|
||||
-dontwarn com.squareup.**
|
||||
|
||||
-dontobfuscate
|
Loading…
Reference in a new issue