Closed euc-callum closed 1 year ago
Hi @euc-callum,
Thanks for reaching out! Unfortunately we're not able to reproduce this on our end with a brand new Expo 47 project and gradle 7.5.1. Could you include the following information to help us troubleshoot the issue?
android/app/build.gradle
fileIn the log of your Android build, there should be a few lines that look like this, not far from the error:
info Writing bundle output to:, /Users/me/apps/expo-47/android/app/build/generated/assets/react/release/index.android.bundle
info Writing sourcemap output to:, /Users/me/apps/expo-47/android/app/build/generated/sourcemaps/react/release/index.android.bundle.map
info Done writing bundle output
info Done writing sourcemap output
Could you copy the build log from these lines to see if anything is moving the bundle file somewhere?
And finally, if you can reproduce the error when building locally (by running npx expo prebuild
then npx expo run:android --variant release
), could you look at the content of your android/app/build/generated
directory and see if the bundle is at the expected location (should be android/app/build/generated/assets/react/release/index.android.bundle
for your RN version).
Thanks a lot! If you want to share more easily outputs, feel free to reach out to our support team in parallel, mentioning this github issue.
Hi @louiszawadzki, thanks for the swift response!
The logs from the Android build are:
info Writing bundle output to:, /home/expo/workingdir/build/android/app/build/generated/assets/react/release/index.android.bundle
info Writing sourcemap output to:, /home/expo/workingdir/build/android/app/build/intermediates/sourcemaps/react/release/index.android.bundle.packager.map
info Done writing bundle output
info Done writing sourcemap output
Running npx expo run:android --variant release
succeeds locally and places the bundle at the expected location:
android/app/build/generated/assets/react/release/index.android.bundle
Running npx eas build --profile development --platform android
fails on expo.dev, with the logs mentioned previously.
We have a similar problem, it seems in the datadog-sourcemaps.gradle file targetName and targetPath are a bit mixed up. We resolved it by applying this patch:
diff --git a/node_modules/@datadog/mobile-react-native/datadog-sourcemaps.gradle b/node_modules/@datadog/mobile-react-native/datadog-sourcemaps.gradle
index c51dc54..080220b 100644
--- a/node_modules/@datadog/mobile-react-native/datadog-sourcemaps.gradle
+++ b/node_modules/@datadog/mobile-react-native/datadog-sourcemaps.gradle
@@ -30,7 +30,7 @@ afterEvaluate {
def targetName = variant.name.capitalize()
def targetPath = variant.dirName
- def reactConfig = getReactConfig(buildDir, targetName)
+ def reactConfig = getReactConfig(buildDir, variant)
def reactRoot = file(reactConfig.root)
def bundleTask = tasks.findByName(reactConfig.bundleTaskName)
@@ -122,8 +122,10 @@ private def getBundleFileResolver(String[] jsBundleDirs, String bundleAssetName)
* - config was in "project.react" and is now in "project.extensions.react"
* - accessing parameters values requires calling a getter
*/
-private def getReactConfig(File buildDir, String targetName) {
+private def getReactConfig(File buildDir, variant) {
def reactConfig = [:]
+ def targetName = variant.name.capitalize()
+ def targetPath = variant.dirName
if (project.extensions.findByName("react")) {
// From RN 0.71
@@ -140,14 +142,14 @@ private def getReactConfig(File buildDir, String targetName) {
// Legacy way, before RN 0.71
def bundleAssetName = project.react.bundleAssetName ?: "index.android.bundle"
reactConfig['bundleTaskName'] = "bundle${targetName}JsAndAssets"
- reactConfig['bundleFileResolver'] = getBundleFileResolver(["$buildDir/generated/assets/react/${targetName}"] as String[], bundleAssetName)
+ reactConfig['bundleFileResolver'] = getBundleFileResolver(["$buildDir/generated/assets/react/${targetPath}"] as String[], bundleAssetName)
reactConfig['bundleAssetName'] = bundleAssetName
reactConfig['root'] = project.react.root ?: "../../"
} else {
// We assume this cannot happen with RN >= 0.71, so we use the legacy default values
def bundleAssetName = "index.android.bundle"
reactConfig['bundleTaskName'] = "bundle${targetName}JsAndAssets"
- reactConfig['bundleFileResolver'] = getBundleFileResolver(["$buildDir/generated/assets/react/${targetName}"] as String[], bundleAssetName)
+ reactConfig['bundleFileResolver'] = getBundleFileResolver(["$buildDir/generated/assets/react/${targetPath}"] as String[], bundleAssetName)
reactConfig['bundleAssetName'] = bundleAssetName
reactConfig['root'] = "../../"
}
Thanks a lot for your insight @jimbofoo! It looks like the previous code passed all checks on Mac filesystems (which is case-insensitive) but breaks on Linux systems (which is case-sensitive). We'll fix this issue in the next patch release.
Thanks, this will fix it for us! Please note it's not just about case-sensitivity, targetPath can be something quite different than targetName with different flavors and variants, for example: targetName can be ProductionFooRelease and targetPath can then be productionFoo/release
Hi,
This issue should be fixed in the new 1.2.1
release.
I'm going to mark the issue as closed, please feel free to reopen the issue if you encounter any trouble fixing it :)
This has resolved our build failures, thanks!
Describe what happened
Since updating to v1.2.0 we've seen Android builds failing with the below error:
I suspect this is related to the included changes modifying how the bundle is located.
We've mitigated this by disabling uploads for Android builds via the following configuration:
Steps to reproduce the issue:
Describe what you expected:
Additional context
Versions: Expo SDK 47, React Native 0.70
package.json
Podfile
andPodfile.lock
android/build.gradle
andandroid/app/build.gradle