Skip to content

Package the Android release bundle under the name React Native loads - #536

Merged
kieran-osgood-shopify merged 1 commit into
mainfrom
fix/android-release-bundle-asset-name
Oct 1, 2026
Merged

kieran-osgood-shopify merged 1 commit into
mainfrom
fix/android-release-bundle-asset-name

Conversation

@kieran-osgood-shopify

Copy link
Copy Markdown
Contributor

What changes are you making?

Packages the sample's Android JavaScript bundle under the asset name React Native loads at runtime.

sample/android/app/build.gradle overrode bundleAssetName to ReactNative.android.bundle. MainApplication uses the default React host, which loads assets://index.android.bundle (DefaultReactHost jsBundleAssetPath = "index", ReactNativeHost.getBundleAssetName()). A release APK built by Gradle therefore packed a bundle the app never reads.

The mismatch dates from the repository reorganisation (#7). Two things hid it:

  • Debug builds load JavaScript from Metro, so the packed asset is never read. CI only builds debug.
  • sample/scripts/release_android writes index.android.bundle into src/main/assets before building.

This change drops the override back to the React Native Gradle plugin default, index.android.bundle, so a Gradle-built release APK contains the bundle the runtime expects.

Split out of the dependency sweep (#529) so it can be reviewed on its own.

How to test

GIVEN the sample has working test-store configuration in sample/.env

AND sample/android/app/src/main/assets contains no JavaScript bundle

AND no Metro server is reachable from the device

WHEN you build with cd sample/android && ./gradlew assembleRelease -PreactNativeArchitectures=arm64-v8a

AND you sign app/build/outputs/apk/release/app-release.apk with app/debug.keystore (apksigner sign --ks app/debug.keystore --ks-pass pass:android --key-pass pass:android --ks-key-alias androiddebugkey), install it, and launch the app

THEN the APK should contain assets/index.android.bundle

AND the app should load the catalog, add a product to the cart, and open checkout without a Metro connection

On main, the same APK contains assets/ReactNative.android.bundle instead, which the runtime does not load.


PR Checklist

Important

Releasing a new version of the kit?


Tip

See the Contributing documentation for instructions on how to publish a new version of the library.

The sample overrode `bundleAssetName` to `ReactNative.android.bundle`, but
`MainApplication` uses the default React host, which loads
`assets://index.android.bundle`. Release APKs built by Gradle therefore
packed a bundle the app never reads. `scripts/release_android` masked this
by writing `index.android.bundle` into `src/main/assets` before building.

Use the React Native Gradle plugin default so Gradle-built release APKs
contain the bundle the runtime expects.
@github-actions

Copy link
Copy Markdown

Coverage Report

Lines Statements Branches Functions
Coverage: 99%
99.12% (227/229) 94.61% (123/130) 100% (67/67)

@kieran-osgood-shopify
kieran-osgood-shopify marked this pull request as ready for review October 1, 2026 10:11
@kieran-osgood-shopify
kieran-osgood-shopify requested a review from a team as a code owner October 1, 2026 10:11
@kieran-osgood-shopify
kieran-osgood-shopify merged commit 3b0ff5f into main Oct 1, 2026
8 checks passed
@kieran-osgood-shopify
kieran-osgood-shopify deleted the fix/android-release-bundle-asset-name branch October 1, 2026 15:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants