Android release bundle is not generated in the correct location on RN 0.71.0-rc.0

This issue has been created since 2022-11-18.

Description

When building for release on Android (yarn android --variant=release), the bundle file is located at android/app/build/ASSETS/createBundleReleaseJsAndAssets/index.android.bundle, which is a change from the previous location of android/app/build/generated/assets/react/Release/index.android.bundle.
The android/app/build/generated does not contain an assets directory anymore.

By looking at the gradle-plugin code, I'm assuming it's not supposed to have changed.

Version

0.71.0-rc.0

Output of npx react-native info

System:
    OS: macOS 12.6.1
    CPU: (10) arm64 Apple M1 Max
    Memory: 3.37 GB / 64.00 GB
    Shell: 5.8.1 - /bin/zsh
  Binaries:
    Node: 18.11.0 - /opt/homebrew/bin/node
    Yarn: 1.22.19 - ~/.npm-global/bin/yarn
    npm: 8.19.2 - /opt/homebrew/bin/npm
    Watchman: 2022.10.24.00 - /opt/homebrew/bin/watchman
  Managers:
    CocoaPods: 1.11.3 - /opt/homebrew/bin/pod
  SDKs:
    iOS SDK:
      Platforms: DriverKit 22.1, iOS 16.1, macOS 13.0, tvOS 16.1, watchOS 9.1
    Android SDK: Not Found
  IDEs:
    Android Studio: 2021.3 AI-213.7172.25.2113.9014738
    Xcode: 14.1/14B47b - /usr/bin/xcodebuild
  Languages:
    Java: 11.0.16.1 - /usr/bin/javac
  npmPackages:
    @react-native-community/cli: Not Found
    react: 18.2.0 => 18.2.0
    react-native: 0.71.0-rc.0 => 0.71.0-rc.0
    react-native-macos: Not Found
  npmGlobalPackages:
    *react-native*: Not Found

Steps to reproduce

  • Create a new app using the command: npx react-native init <YourAppName> --version 0.71.0-rc.0
  • Manually download the maven-local.zip archive (you can also find the link in this release).
  • Unzip the maven-local.zip on a folder on your disk.
  • Add the REACT_NATIVE_MAVEN_LOCAL_REPO=<path_to_the_maven-local_unzipped_folder> setting to the android/gradle.properties file
  • Build with yarn android --variant=release

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

Screenshot of the android folder directory after a build:

image

louiszawadzki wrote this answer on 2022-11-18

After a quick investigation, deleting this line makes the bundle to be generated in the right location again:

variant.sources.assets?.addGeneratedSourceDirectory(bundleTask, BundleHermesCTask::jsBundleDir)
cortinico wrote this answer on 2022-11-23

When building for release on Android (yarn android --variant=release), the bundle file is located at android/app/build/ASSETS/createBundleReleaseJsAndAssets/index.android.bundle, which is a change from the previous location of android/app/build/generated/assets/react/Release/index.android.bundle.
The android/app/build/generated does not contain an assets directory anymore.

I don't understand what's the bug here.
The index.android.bundle is properly located in the final APK (as the app is running).

Images are missing, which is another bug we're looking into #35439.

But what should be fixed here?

louiszawadzki wrote this answer on 2022-11-23

I work on the Datadog SDK, which provide an error tracking system. We use the bundle for adding more context to errors in Datadog, in addition to the sourcemaps.
We also provide users with a script that will locate that bundle and upload it. Currently it looks for android/app/build/generated/assets/react/{variant}/index.android.bundle.

If the location changes it's not so much of an issue for us, I wanted to raise this to get confirmation that this is indeed going to change before making the change on our side, and in case there was some bug hidden behind it.

louiszawadzki wrote this answer on 2022-11-23

I'll close this issue, as it seems there is no hidden bug behind it :)

cortinico wrote this answer on 2022-11-23

I'll close this issue, as it seems there is no hidden bug behind it :)

Nope the change was intended. We now use the Artifacts API of AGP so we don't have to "hardcode" paths around anymore. As AGP changes paths, we won't be affected by future breakages.

More Details About Repo
Owner Name facebook
Repo Name react-native
Full Name facebook/react-native
Language JavaScript
Created Date 2015-01-09
Updated Date 2022-12-10
Star Count 106395
Watcher Count 3660
Fork Count 22685
Issue Count 2288

YOU MAY BE INTERESTED

Issue Title Created Date Comment Count Updated Date
Shortcut Arrangement Start Page 0 2022-07-07 2022-11-10
Is there any way to show some part of next element? 1 2021-08-29 2022-07-08
Win2022 Dev [10.0.25151.1000 release] 0 2022-07-06 2022-11-19
[Question] How to rewrite internal url to pretty url? 1 2022-07-14 2022-09-19
The install target ignores PREFIX 9 2022-05-01 2022-09-25
Shared aa substitutions vs. shared nucleotide mutations 1 2022-08-31 2022-09-28
ENH: Add India to case plots - India is really interesting case 3 2022-09-04 2022-09-28
what is the parameter "--level" in test.py? 3 2021-02-22 2022-10-15
Feature Request: dragonwell JDK 2 2022-02-18 2022-10-23
Manual page contains three dashes for each full name parameter instead of two 1 2022-06-15 2022-11-06
Keep ns :require (and others) linebreaks 1 2020-02-26 2022-11-02
Using the VBA code 0 2021-03-08 2022-01-02
Worktrees fail to load in working path with spaces 2 2022-03-01 2022-10-06
How is the coordinate system in pose estimation defined? 0 2022-01-21 2022-11-18
[FEATURE] Time window different of 1 day for Slack notifications 0 2022-04-28 2022-10-22
Include Version Number in output 0 2021-01-21 2022-11-30
Add an option to toggle the menu bar on/off when using Native Title bar style. 1 2021-05-18 2022-11-04
"./flexdef.h", line 72: cannot find include file: <stdbool.h> 2 2022-07-17 2022-11-22
Add emoji picker to comment section 3 2022-05-25 2022-10-24
Expand monero support beyond amd64 3 2021-12-20 2022-11-13
Update for VerneMQ 1.12.5 1 2022-07-07 2022-12-09
Add Hamiltonians to documentation of lattice models 0 2022-05-04 2022-10-30
How to batch insert when insert bitmap with JDBC interface 1 2021-12-08 2022-11-29
Youtube download Speed Limited to 60 Kbps 0 2021-10-27 2022-11-21
新建项目(Vite+Vue+TS),在vivo手机自带浏览器白屏 2 2022-08-18 2022-12-01
Spelling correction 2nd paragraph 1 2021-10-28 2022-11-29
Document need to updated to match v.1.0.0 of the TF module 4 2021-10-16 2022-11-29
Fix pr-preview config (for ReSpec) 1 2021-08-30 2022-10-07
Application Crash Upon Loading Large Folder 6 2018-06-04 2022-11-25
Records Incorrect IP Address - IPv6 not supported 0 2022-01-18 2022-11-06
Bundle link for dataset common voice 7 2 2021-08-07 2022-12-05
A little doubt about AQE's code 3 2021-11-17 2022-11-21
CURD组件其它组件触发reload的时候怎么重置分页到第一页 2 2021-11-25 2021-12-28
Global text replacement - does not render 1 2021-11-25 2021-11-27
Pagination 2 2021-04-19 2022-01-11
Name extraction for vals inside component func defs 4 2022-09-02 2022-10-07
com.example.storage.bucket.CreateBucketDualRegionTest: testCreateBucketDualRegion failed 3 2022-08-25 2022-10-30
Add support for Autoclass 0 2022-08-30 2022-10-30
Dropdowns look different 1 2022-08-26 2022-08-19
Toolbar feature flag multivariate contrast 1 2022-08-26 2022-08-30
cpp grpc generation does not comment out name of unused parameter in disabled method 0 2022-07-14 2022-10-06
CORE-2087: Allow cordapp-cpk to apply OSGi "consumer policy" to Corda packages. 0 2021-07-26 2022-09-09
Invalid config for [recorder]: [username] is an invalid option for [recorder] 2 2022-07-09 2022-07-09
Sensibo integration does not expose the service to reset filter 3 2022-07-09 2022-10-21
Deploying Flatcar on vSphere fails 3 2021-12-08 2022-10-11
core: Forgetting or deleting runners results in bad job assignments 0 2022-11-29 2022-11-29
[CLI] Add better usage documentation in README (and link to it from CLI) 14 2020-12-10 2022-11-29
Add TorchSharp-cuda package 0 2022-02-10 2022-12-03
BufferBuilder.MakeDense: IndexOutOfRangeException 1 2022-01-01 2022-12-02
Failed assertion: line 5339 pos 12: '_history.isNotEmpty': is not true. 5 2021-11-24 2022-12-07