Skip to content

Commit

Permalink
Update proguard rules (#3310)
Browse files Browse the repository at this point in the history
* Updated ProGuard rules
* Ensure release works correctly

---------

Co-authored-by: Asif Ghanchi <[email protected]>
Co-authored-by: Seaborn Lee <[email protected]>
  • Loading branch information
3 people authored Sep 20, 2023
1 parent a462144 commit a912eaf
Show file tree
Hide file tree
Showing 2 changed files with 63 additions and 5 deletions.
9 changes: 5 additions & 4 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -155,16 +155,17 @@ android {
debug {
minifyEnabled false
shrinkResources false
// proguardFiles getDefaultProguardFile('proguard-android.txt'),
// 'proguard-rules.pro'
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}

release {
minifyEnabled false
minifyEnabled true
shrinkResources false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'

if (signingConfigs.release.storeFile) {
signingConfig signingConfigs.release
}
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
packagingOptions {
Expand Down
59 changes: 58 additions & 1 deletion app/proguard-rules.pro
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
# Uncomment this to preserve the line number information for
# debugging stack traces.
-keepattributes SourceFile,LineNumberTable
-keepattributes AnnotationDefault,RuntimeVisibleAnnotations

# If you keep the line number information, uncomment this to
# hide the original source file name.
Expand All @@ -29,11 +30,67 @@
-dontskipnonpubliclibraryclasses
-dontskipnonpubliclibraryclassmembers
-dontpreverify
-allowaccessmodification
-verbose
-printseeds seeds.txt
-printusage unused.txt
-printmapping mapping.txt
-optimizations !code/simplification/arithmetic,!field/*,!class/merging/*

-dontwarn jnr.posix.**
-dontwarn org.slf4j.**

-keepattributes Signature
-keep class com.google.gson.reflect.TypeToken { *; }
-keep class * extends com.google.gson.reflect.TypeToken
-if interface * { @retrofit2.http.* public *** *(...); }
-keep,allowoptimization,allowshrinking,allowobfuscation class <3>

#---------------Begin: proguard configuration for support library ----------
-keep class wallet.core {*;}
-keepclassmembers class * extends android.content.Context {
public void *(android.view.View);
public void *(android.view.MenuItem);
}

-keepclasseswithmembernames,includedescriptorclasses class * {
native <methods>;
}

#trust library
-keep class wallet.core.jni.HDWallet { *; }
-keep class wallet.core.jni.Hash { *; }
-keep class wallet.core.jni.Curve { *; }
-keep class wallet.core.jni.CoinType { *; }
-keep class wallet.core.jni.Mnemonic { *; }
-keep class wallet.core.jni.PrivateKey { *; }
-keep class wallet.core.jni.proto.** { *; }

#entities, jsInterface & listeners
-keep class com.alphawallet.token.** { *; }
-keep class com.alphawallet.app.walletconnect.** { *; }
-keep class com.alphawallet.app.web3.** { *; }
-keep class com.alphawallet.app.web3j.** { *; }
-keep class com.alphawallet.app.entity.** { *; }
-keep class io.stormbird.wallet.model.api.** { *; }

-keep public class java.beans.* { *; }
-keep class jnr.unixsocket.* { *; }
-keep class org.java_websocket.client.*
-keep class org.java_websocket.handshake.*

-keepclassmembers class org.web3j.protocol.** { *; }
-keepclassmembers class org.web3j.crypto.* { *; }

-keep class * extends org.web3j.abi.TypeReference
-keep class * extends org.web3j.abi.datatypes.Type

-dontwarn org.bouncycastle.jce.provider.X509LDAPCertStoreSpi
-dontwarn org.bouncycastle.x509.util.LDAPStoreHelper

-keep class java.beans.Transient.** {*;}
-keep class java.beans.ConstructorProperties.** {*;}
-keep class java.nio.file.Path.** {*;}

-repackageclasses
#-dontobfuscate
#-printconfiguration ../full-r8-config.txt

0 comments on commit a912eaf

Please sign in to comment.