chore(android): enable R8 shrinker with keep rules, set up release signing, and strip sourcemaps from APK
This commit is contained in:
parent
ffb80bff88
commit
4e7ea405ab
3 changed files with 48 additions and 9 deletions
|
|
@ -20,12 +20,6 @@ android {
|
|||
ignoreAssetsPattern = '!.svn:!.git:!.ds_store:!*.scc:.*:!CVS:!thumbs.db:!picasa.ini:!*~'
|
||||
}
|
||||
}
|
||||
buildTypes {
|
||||
release {
|
||||
minifyEnabled false
|
||||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
||||
}
|
||||
}
|
||||
// AGP 8+ requires explicit opt-in for BuildConfig generation. We rely on
|
||||
// BuildConfig.DEBUG to gate Log.d calls that dump privacy-sensitive
|
||||
// identifiers (roomId, eventId) so release builds don't leak them through
|
||||
|
|
@ -33,6 +27,26 @@ android {
|
|||
buildFeatures {
|
||||
buildConfig = true
|
||||
}
|
||||
|
||||
signingConfigs {
|
||||
release {
|
||||
if (project.hasProperty('VOJO_RELEASE_STORE_FILE')) {
|
||||
storeFile file(VOJO_RELEASE_STORE_FILE)
|
||||
storePassword VOJO_RELEASE_STORE_PASSWORD
|
||||
keyAlias VOJO_RELEASE_KEY_ALIAS
|
||||
keyPassword VOJO_RELEASE_KEY_PASSWORD
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
release {
|
||||
minifyEnabled true
|
||||
shrinkResources true
|
||||
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
||||
signingConfig signingConfigs.release
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
repositories {
|
||||
|
|
|
|||
24
android/app/proguard-rules.pro
vendored
24
android/app/proguard-rules.pro
vendored
|
|
@ -19,3 +19,27 @@
|
|||
# If you keep the line number information, uncomment this to
|
||||
# hide the original source file name.
|
||||
#-renamesourcefileattribute SourceFile
|
||||
|
||||
# Keep custom app classes — entry points invoked by Android system (Intents,
|
||||
# FCM, AndroidManifest references) or by JS bridge via reflection.
|
||||
-keep class chat.vojo.app.MainActivity { *; }
|
||||
-keep class chat.vojo.app.VojoFirebaseMessagingService { *; }
|
||||
-keep class chat.vojo.app.CallForegroundPlugin { *; }
|
||||
-keep class chat.vojo.app.CallForegroundService { *; }
|
||||
-keep class chat.vojo.app.CallDeclineReceiver { *; }
|
||||
-keep class chat.vojo.app.CallCancelReceiver { *; }
|
||||
-keep class chat.vojo.app.FullScreenIntentPlugin { *; }
|
||||
-keep class chat.vojo.app.LaunchSplashPlugin { *; }
|
||||
|
||||
# Firebase Messaging — receivers/services resolved by Android via manifest.
|
||||
-keep public class * extends com.google.firebase.messaging.FirebaseMessagingService
|
||||
-keep class com.google.firebase.iid.** { *; }
|
||||
-keep class com.google.firebase.messaging.** { *; }
|
||||
|
||||
# Capacitor — plugins discovered by annotation/reflection.
|
||||
-keep @com.getcapacitor.annotation.CapacitorPlugin class * { *; }
|
||||
-keep class com.getcapacitor.** { *; }
|
||||
-keep class com.getcapacitor.plugin.** { *; }
|
||||
|
||||
# AndroidX splashscreen — reflection paths.
|
||||
-keep class androidx.core.splashscreen.** { *; }
|
||||
|
|
|
|||
|
|
@ -19,12 +19,13 @@
|
|||
"gen:push-strings": "node scripts/gen-push-strings.mjs",
|
||||
"android:sync": "npx cap sync android",
|
||||
"android:open": "npx cap open android",
|
||||
"android:strip-sourcemaps": "find dist -name '*.map' -delete",
|
||||
"android:apk:debug": "cd android && ./gradlew assembleDebug",
|
||||
"android:apk:release": "cd android && ./gradlew assembleRelease",
|
||||
"android:aab:release": "cd android && ./gradlew bundleRelease",
|
||||
"build:android:debug": "npm run build && npm run android:sync && npm run android:apk:debug",
|
||||
"build:android:release": "npm run build && npm run android:sync && npm run android:apk:release",
|
||||
"build:android:aab": "npm run build && npm run android:sync && npm run android:aab:release",
|
||||
"build:android:debug": "npm run build && npm run android:strip-sourcemaps && npm run android:sync && npm run android:apk:debug",
|
||||
"build:android:release": "npm run build && npm run android:strip-sourcemaps && npm run android:sync && npm run android:apk:release",
|
||||
"build:android:aab": "npm run build && npm run android:strip-sourcemaps && npm run android:sync && npm run android:aab:release",
|
||||
"prepare": "husky install",
|
||||
"commit": "git-cz"
|
||||
},
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue