TagSpaces is an offline, open source, document manager with tagging support
chore: enabling app minification and schrinking
Ilian Sapundshiev2074510deb9a
diff --git a/capacitor/android/app/build.gradle b/capacitor/android/app/build.gradleindex c9a415e6d..b01269d12 100644--- a/capacitor/android/app/build.gradle+++ b/capacitor/android/app/build.gradle@@ -18,7 +18,13 @@ android {}buildTypes {release {- minifyEnabled false+ // R8 code + resource shrinking for the Play Store release. Capacitor+ // and Cordova load plugins reflectively by class name, so the keep+ // rules in proguard-rules.pro are REQUIRED — without them R8 strips+ // or renames plugin classes and they fail to register at runtime.+ // Re-test every plugin on a release build after touching this.+ minifyEnabled true+ shrinkResources trueproguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'}}diff --git a/capacitor/android/app/proguard-rules.pro b/capacitor/android/app/proguard-rules.proindex f1b424510..ff1d34941 100644--- a/capacitor/android/app/proguard-rules.pro+++ b/capacitor/android/app/proguard-rules.pro@@ -19,3 +19,46 @@# If you keep the line number information, uncomment this to# hide the original source file name.#-renamesourcefileattribute SourceFile++# ---------------------------------------------------------------------------+# Capacitor / Cordova keep rules (required when minifyEnabled = true)+#+# Capacitor instantiates plugins reflectively by class name (read from+# assets/capacitor.plugins.json) and dispatches to @PluginMethod-annotated+# methods, also via reflection. R8 can't see those references statically, so+# without these rules it strips or renames the classes and registration fails+# at runtime ("Plugin X not found" / native calls silently no-op).+# ---------------------------------------------------------------------------++# Preserve annotations, signatures, inner classes and JS-bridge metadata that+# the reflective bridge depends on.+-keepattributes *Annotation*, Signature, InnerClasses, EnclosingMethod, JavascriptInterface++# Capacitor framework + bundled plugins.+-keep class com.getcapacitor.** { *; }+-keep class com.capacitorjs.plugins.** { *; }++# Anything annotated as a Capacitor plugin, and all plugin-method / JS-interface+# members — covers current and future plugins generically.+-keep @com.getcapacitor.annotation.CapacitorPlugin class * { *; }+-keep class * extends com.getcapacitor.Plugin { *; }+-keepclassmembers class * {+ @com.getcapacitor.annotation.PermissionCallback <methods>;+ @com.getcapacitor.annotation.ActivityCallback <methods>;+ @com.getcapacitor.PluginMethod public <methods>;+ @android.webkit.JavascriptInterface <methods>;+}++# Cordova bridge layer (capacitor-cordova-android-plugins module).+-keep class org.apache.cordova.** { *; }+-keep public class * extends org.apache.cordova.CordovaPlugin { *; }++# Third-party Capacitor plugins (classpaths from capacitor.plugins.json) — each+# is referenced only by name, so keep the whole package.+-keep class ar.com.anura.plugins.** { *; } # @anuradev/capacitor-background-mode+-keep class com.ryltsov.alex.plugins.** { *; } # @capacitor-community/file-opener+-keep class io.capawesome.capacitorjs.plugins.** { *; } # @capawesome/capacitor-file-picker++# This app's custom native plugins (StoragePermission, IntentHandler).+-keep class org.tagspaces.plugins.** { *; }+-keep class org.tagspaces.mobileapp.** { *; }