From 27bec1645374570e58c06247eac42922766f6a54 Mon Sep 17 00:00:00 2001 From: Adam Speakman Date: Tue, 3 Nov 2026 18:25:53 +1300 Subject: [PATCH] Keep name-resolved resources from the Android resource shrinker CodePush reads CODE_PUSH_APK_BUILD_TIME and the CodePush strings and bools through Resources.getIdentifier. The resource shrinker cannot trace those lookups, and the optimized shrinker that Android Gradle plugin 9 turns on by default (android.r8.optimizedResourceShrinking) no longer keeps resources whose names appear as string constants in dex, which the legacy shrinker's safe mode did. With shrinkResources enabled on such a build: - CODE_PUSH_APK_BUILD_TIME is removed, so getBinaryResourcesModifiedTime throws Resources$NotFoundException ("String resource ID #0x0") whenever a downloaded package exists on disk. Every user who upgrades the app with a previously downloaded update crash-loops on cold start, before clearUpdates() can run. - CodePushServerUrl is removed, so the runtime silently falls back to the default server URL and never reaches the configured one. Ship a tools:keep in the library's res/raw so every consumer is covered when the AAR's resources merge into the app, the same way Firebase keeps its own name-resolved strings (firebase_common_keep.xml). Co-Authored-By: Claude Fable 5.1 --- android/app/src/main/res/raw/codepush_keep.xml | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 android/app/src/main/res/raw/codepush_keep.xml diff --git a/android/app/src/main/res/raw/codepush_keep.xml b/android/app/src/main/res/raw/codepush_keep.xml new file mode 100644 index 00000000..c29dff9c --- /dev/null +++ b/android/app/src/main/res/raw/codepush_keep.xml @@ -0,0 +1,11 @@ + + +