-
Notifications
You must be signed in to change notification settings - Fork 24.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bundle not included in APK from within Android Studio #33018
Comments
Something similar happened to us when upgrading the Gradle plugin to v7 (from v4). |
The logic for bundling the asset is here: Lines 317 to 329 in 10199b1
I'm not sure what is the destination folder for AGP 7.x but if that is the case, we should be fine by just adding another rule there. Do you want to try submitting a PR for this @djibarian ? |
…cebook#33057) Summary: Upgrade Android Gradle to 7.1.0 on template and fix a bug where the bundle was not getting included when building the app in release mode Closes facebook#33002 Closes facebook#33018 Closes facebook#33046 Potentially fixes facebook#33029 ## Changelog [Android] [Changed] - Bump AGP to 7.1.0 and fix bundle inclusion in release mode Pull Request resolved: facebook#33057 Test Plan: 1. Run `./scripts/test-manual-e2e.sh` 2. Select `A new RN app using the template` and `Android` 3. Test app on the emulator 4. Open Android studio build the app using release variant 4. Check the release apk using Android studio "Analyze APK" tool and ensure the bundle is included ![image](https://user-images.githubusercontent.com/11707729/152700410-3bcb80b0-35b6-4bdc-bf57-98a42a29e5a6.png) Reviewed By: ShikaSD Differential Revision: D34076884 Pulled By: cortinico fbshipit-source-id: da4392af37e08e22dbcafba38476fd712141474a
Description
Following on the issue #21132 I came to a slightly different problem. It seems that that issue refers to using
react-native run-android
, and that seems to finally work properly, i.e. the bundle is added to the APK properly.But when building from Android Studio for release the bundle is still missing. I finally found the problem to be the same.
build.gradle
states that the default setting forjsBundleDirRelease
is$buildDir/intermediates/assets/release
, which is wrong. This must be changed to$buildDir/intermediates/assets/release/mergeReleaseAssets
for Gradle to take the asset and add it to the APK.So to avoid having to set
jsBundleDirRelease
to a proper value, it would be good to have the default value updated for this to work not only from thereact-native run-android
script, but also from Android Studio.Version
0.66.4
Output of
npx react-native info
System:
OS: macOS 12.2
CPU: (10) arm64 Apple M1 Pro
Memory: 195.25 MB / 16.00 GB
Shell: 5.8 - /bin/zsh
Binaries:
Node: 16.13.0 - /usr/local/bin/node
Yarn: 1.22.15 - /usr/local/bin/yarn
npm: 8.3.0 - /usr/local/bin/npm
Watchman: Not Found
Managers:
CocoaPods: 1.11.2 - /usr/local/bin/pod
SDKs:
iOS SDK:
Platforms: DriverKit 21.2, iOS 15.2, macOS 12.1, tvOS 15.2, watchOS 8.3
Android SDK:
API Levels: 26, 29, 30, 31, 32
Build Tools: 30.0.2, 30.0.3, 32.0.0
System Images: android-32 | Google APIs ARM 64 v8a
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.11 - /usr/bin/javac
npmPackages:
@react-native-community/cli: Not Found
react: ^17.0.2 => 17.0.2
react-native: ^0.66.4 => 0.66.4
react-native-macos: Not Found
npmGlobalPackages:
react-native: Not Found
Steps to reproduce
Just try to build for release in Android Studio. Then inspect the APK in
app/build/intermediates/apk
and find that theassets
folder is missing.Snack, code example, screenshot, or link to a repository
No response
The text was updated successfully, but these errors were encountered: