diff --git a/android/app/proguard-rules.pro b/android/app/proguard-rules.pro index 551eb41d..88ba752b 100644 --- a/android/app/proguard-rules.pro +++ b/android/app/proguard-rules.pro @@ -12,3 +12,12 @@ -keep class com.facebook.react.turbomodule.** { *; } # Add any project specific keep options here: + +# The app's own native code (com.anonymous.bulwarkmobile). What R8 must not +# drop or rename there is already covered elsewhere: React Native's rules keep +# every NativeModule, whose @ReactMethod methods JS calls by name, and AAPT +# keeps the application, activity and services listed in AndroidManifest.xml +# (FCM, UnifiedPush and the headless JS task). Keeping the package whole on +# top of that costs a few KB and leaves its class and method names readable +# in a crash report from an obfuscated release build. +-keep class com.anonymous.bulwarkmobile.** { *; } diff --git a/android/gradle.properties b/android/gradle.properties index ad02561b..9d57fd03 100644 --- a/android/gradle.properties +++ b/android/gradle.properties @@ -25,6 +25,11 @@ android.useAndroidX=true # Enable AAPT2 PNG crunching android.enablePngCrunchInReleaseBuilds=true +# Shrink release builds with R8 (code) and the resource shrinker. Keep rules +# for classes reached by reflection go in app/proguard-rules.pro. +android.enableMinifyInReleaseBuilds=true +android.enableShrinkResourcesInReleaseBuilds=true + # Use this property to specify which architecture you want to build. # You can also override it from the CLI using # ./gradlew -PreactNativeArchitectures=x86_64