diff --git a/README.md b/README.md index ccfa8a2..0595d7d 100644 --- a/README.md +++ b/README.md @@ -83,6 +83,9 @@ If you would like to get the most recent code in a jar, clone the project and ru You may also add the library as an Android Library to your project. All the library files live in ```library```. +### R8 / ProGuard +The specific rules are [already bundled](library/src/main/resources/META-INF/proguard/autocomplete.pro) into the JAR which can be interpreted by R8 automatically. + Creating your auto complete view -------------------------------- diff --git a/example/build.gradle b/example/build.gradle index 47e7fce..c5e84c1 100644 --- a/example/build.gradle +++ b/example/build.gradle @@ -23,8 +23,12 @@ android { testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } buildTypes { + all { + signingConfig signingConfigs.debug + } release { - minifyEnabled false + minifyEnabled true + proguardFiles getDefaultProguardFile("proguard-android-optimize.txt"), 'proguard-rules.pro' } } compileOptions { diff --git a/gradle.properties b/gradle.properties index 973d43e..9c65764 100644 --- a/gradle.properties +++ b/gradle.properties @@ -31,4 +31,6 @@ POM_DEVELOPER_ID=mgod POM_DEVELOPER_NAME=Marshall Weir android.useAndroidX=true android.enableJetifier=false +# Enable R8 full mode. +android.enableR8.fullMode=true org.gradle.jvmargs=-Xmx4096m "-XX:MaxMetaspaceSize=512m" diff --git a/library/src/main/resources/META-INF/proguard/autocomplete.pro b/library/src/main/resources/META-INF/proguard/autocomplete.pro new file mode 100644 index 0000000..d6e59d6 --- /dev/null +++ b/library/src/main/resources/META-INF/proguard/autocomplete.pro @@ -0,0 +1,3 @@ +# Keep generic types for R8 fullMode. +-keep,allowobfuscation,allowshrinking class com.tokenautocomplete.TokenCompleteTextView +-keep,allowobfuscation,allowshrinking class * extends com.tokenautocomplete.TokenCompleteTextView \ No newline at end of file