FULL AI ANALYSIS

React Native Android release APK crashes on cold start only when R8 minification is enabled — index.android.bundle missing at runtime

Generated Oct 15, 2026, 9:17:34 AM

Analysis summary

The most consistent finding is that resource shrinking or an R8 optimization/packaging step is removing the JS asset from the APK or altering asset packaging so the app can't find index.android.bundle at runtime. Possible causes include a misconfigured Gradle sourceSets or react.gradle hook being skipped in minified releases, or shrinkResources erroneously pruning the asset because it's not referenced in native resource tables. Another possible (but less likely) cause: R8 obfuscation removes classes that run bundle-loading code, preventing the bundle task from running or preventing runtime lookup, which explains why bundle may appear present but the loader fails. CI differences (e.g., environment variable that controls bundle generation) could also be involved.

Possible causes

Gradle resource shrinking or packaging step (shrinkResources/minify) strips the index.android.bundle asset because it's not referenced in R files, causing the bundle to be absent in the release APK

65%

R8/ProGuard optimizations remove classes or methods responsible for initializing the React Native bridge or locating assets at runtime, causing a crash even when the bundle exists

40%

Bundle generation task is being skipped in CI for release/minified builds because of an environment difference or modified react.gradle hook (e.g., NODE_BINARY path or gradle property not set), so no bundle is produced to include

30%

Custom ProGuard rules are incomplete or conflicting, leading to runtime errors that are obfuscated and appear as startup crash rather than clear ClassNotFound messages

25%

Suggested fixes

1

Diagnostic step 1

Unzip the problematic release APK and verify presence and path of assets/index.android.bundle. If missing, the problem is packaging — focus on Gradle tasks.

2

Diagnostic step 2

Temporarily set minifyEnabled=true and shrinkResources=false to isolate whether resource shrinking removes the asset. If bundle present with shrinkResources off but missing when enabled, add keep rules to prevent the asset from being stripped or disable resource shrinking.

3

Diagnostic step 3

Ensure the RN gradle bundle task runs in release: run ./gradlew assembleRelease --info and look for ':app:bundleReleaseJsAndAssets' execution and its output. If the task is skipped, check react.gradle inclusion and NODE_BINARY environment variable in CI.

4

Diagnostic step 4

Add targeted ProGuard keep rules for React Native bootstrap classes (keep com.facebook.react.** and com.facebook.jni.**), then rebuild to see if crash disappears while bundle packaging remains intact.

5

Diagnostic step 5

Inspect adb logcat for the obfuscated exception and upload mapping.txt from R8 to deobfuscate the stack trace. This can show if the crash is due to missing classes rather than absent bundle; if so, iterate ProGuard rules accordingly. If uncertain after these steps, collect APK contents and gradle logs and escalate to a build-tooling specialist with CI and gradle configuration attached.