From 8456b40be418306cb1f55042d0edbcec9a27475b Mon Sep 17 00:00:00 2001 From: Josue Leon Sarkis Date: Thu, 8 Feb 2024 10:21:33 -0600 Subject: [PATCH] =?UTF-8?q?chore:=20enabling=20code=20shrinking=20and=20ob?= =?UTF-8?q?fuscation=20in=20the=20example=20app=20and=E2=80=A6=20(#102)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 3 +++ example/build.gradle | 3 ++- example/proguard-rules.pro | 29 +++++++++++------------------ 3 files changed, 16 insertions(+), 19 deletions(-) diff --git a/README.md b/README.md index 8a9aedf5..46591a13 100644 --- a/README.md +++ b/README.md @@ -32,6 +32,9 @@ Add this dependency to your project's build file: } ``` +Add the ProGuard rules found in example/proguard-rules.pro to your project's rules if you build +enables code shrinking or obfuscation + ## Features - [TextElement](https://developers.basistheory.com/docs/sdks/mobile/android/types#textelement) to securely collect text input diff --git a/example/build.gradle b/example/build.gradle index 6212e0ae..076777c1 100644 --- a/example/build.gradle +++ b/example/build.gradle @@ -22,7 +22,8 @@ android { buildTypes { release { - minifyEnabled false + minifyEnabled true + shrinkResources true proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' } } diff --git a/example/proguard-rules.pro b/example/proguard-rules.pro index 481bb434..ef4edc63 100644 --- a/example/proguard-rules.pro +++ b/example/proguard-rules.pro @@ -1,21 +1,14 @@ -# Add project specific ProGuard rules here. -# You can control the set of applied configuration files using the -# proguardFiles setting in build.gradle. -# -# For more details, see -# http://developer.android.com/guide/developing/tools/proguard.html +-dontwarn javax.validation.valueextraction.UnwrapByDefault +-dontwarn javax.validation.valueextraction.ValueExtractor -# If your project uses WebView with JS, uncomment the following -# and specify the fully qualified class name to the JavaScript interface -# class: -#-keepclassmembers class fqcn.of.javascript.interface.for.webview { -# public *; -#} +# Needed to keep generic signatures +-keepattributes Signature -# Uncomment this to preserve the line number information for -# debugging stack traces. -#-keepattributes SourceFile,LineNumberTable +# Used by Gson serialization and deserialization internally in BT's SDK +-keep class com.google.gson.reflect.TypeToken { *; } +-keep class * extends com.google.gson.reflect.TypeToken -# If you keep the line number information, uncomment this to -# hide the original source file name. -#-renamesourcefileattribute SourceFile \ No newline at end of file +# BT's SDK classes +-keep class com.basistheory.** { + *; +} \ No newline at end of file