Skip to content

[Android] Release builds broken when using Android Gradle plugin 7.1.0 or higher #33002

@AlexanderEggers

Description

@AlexanderEggers

Description

I have noticed that the RN Android project is creating broken release builds when using the Android Gradle plugin (com.android.tools.build:gradle) version 7.1.0 or higher. 7.1.0 got stable with the recent Android Studio Bumblebee release.

The actual issue is around the index.android.bundle file which is still correctly generated but is missing from the actual apk/bundle file. That results in the application showing "Unable to load script from assets 'index.android.bundle'...". Possible workarounds are running react-native bundle and creating a index.android.bundle file in the app assets folder or to simply downgrade to Android Gradle plugin version 7.0.4.

Version

0.67.1

Output of npx react-native info

System:
OS: macOS 12.1
CPU: (12) x64 Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz
Memory: 49.55 MB / 16.00 GB
Shell: 5.8 - /bin/zsh
Binaries:
Node: 14.17.5 - /usr/local/bin/node
Yarn: 1.22.11 - /usr/local/bin/yarn
npm: 8.3.0 - /usr/local/bin/npm
Watchman: 2022.01.24.00 - /usr/local/bin/watchman
Managers:
CocoaPods: 1.11.2 - /Users/alex/.rbenv/shims/pod
SDKs:
iOS SDK:
Platforms: DriverKit 21.2, iOS 15.2, macOS 12.1, tvOS 15.2, watchOS 8.3
Android SDK:
API Levels: 28, 31
Build Tools: 30.0.2, 30.0.3, 32.0.0
System Images: android-28 | Google Play Intel x86 Atom_64, android-31 | Google APIs Intel x86 Atom_64, android-31 | Google Play Intel x86 Atom_64
Android NDK: Not Found
IDEs:
Android Studio: 2021.1 AI-211.7628.21.2111.8092744
Xcode: 13.2.1/13C100 - /usr/bin/xcodebuild
Languages:
Java: 11.0.12 - /usr/bin/javac
npmPackages:
@react-native-community/cli: Not Found
react: 17.0.2 => 17.0.2
react-native: 0.67.1 => 0.67.1
react-native-macos: Not Found
npmGlobalPackages:
react-native: Not Found

Steps to reproduce

Upgrade the Android Gradle plugin to version 7.1.0 for any RN project and run a release build for that one. That will successfully compile but the release build will be useless because of the "Unable to load script from assets 'index.android.bundle'..." error when starting the app.

Snack, code example, screenshot, or link to a repository

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Help Wanted :octocat:Issues ideal for external contributors.Platform: AndroidAndroid applications.Resolution: LockedThis issue was locked by the bot.Shared with MetaApplied via automation to indicate that an Issue or Pull Request has been shared with the team.Tool: Gradle

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions