expo: Android build fails on createReleaseExpoManifest
🐛 Bug Report
A brand new expo bare-minimum app fails to build for release on Android. It fails during the :app:createReleaseExpoManifest task, because it cannot connect to 127.0.0.1:8081
A workaround is to run react-native start in a separate terminal / process so that the Metro bundler is running. Build will succeed.
Environment
Expo CLI 3.20.9 environment info:
System:
OS: macOS 10.15.4
Shell: 3.2.57 - /bin/bash
Binaries:
Node: 12.16.2 - ~/.nvm/versions/node/v12.16.2/bin/node
Yarn: 1.22.4 - ~/.nvm/versions/node/v12.16.2/bin/yarn
npm: 6.14.4 - ~/.nvm/versions/node/v12.16.2/bin/npm
Watchman: 4.9.0 - /usr/local/bin/watchman
IDEs:
Android Studio: 3.6 AI-192.7142.36.36.6392135
Xcode: 11.4.1/11E503a - /usr/bin/xcodebuild
npmGlobalPackages:
expo-cli: 3.20.9
App target: Android
Steps to Reproduce
First, switch to recent node LTS (12.16.2), and install expo CLI and react-native CLI:
nvm use 12.16.2
npm i -g expo-cli
npm i -g react-native-cli
Then run the following commands to create a fresh bare minimum app and attempt to create an android bundle release:
expo init --template bare-minimum ExpoRNDebug
cd ExpoRNDebug
cd android
./gradlew bundleRelease
Expected Behavior
BUILD SUCCESSFUL
Actual Behavior
> Task :app:createReleaseExpoManifest FAILED
events.js:287
throw er; // Unhandled 'error' event
^
Error: connect ECONNREFUSED 127.0.0.1:8081
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1141:16)
Emitted 'error' event on ClientRequest instance at:
at Socket.socketErrorListener (_http_client.js:426:9)
at Socket.emit (events.js:310:20)
at emitErrorNT (internal/streams/destroy.js:92:8)
at emitErrorAndCloseNT (internal/streams/destroy.js:60:3)
at processTicksAndRejections (internal/process/task_queues.js:84:21) {
errno: 'ECONNREFUSED',
code: 'ECONNREFUSED',
syscall: 'connect',
address: '127.0.0.1',
port: 8081
}
w: Detected multiple Kotlin daemon sessions at build/kotlin/sessions
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:createReleaseExpoManifest'.
> Process 'command 'node'' finished with non-zero exit value 1
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
Deprecated Gradle features were used in this build, making it incompatible with Gradle 6.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/5.6.3/userguide/command_line_interface.html#sec:command_line_warnings
BUILD FAILED in 2m 15s
430 actionable tasks: 430 executed
Workaround
Run react-native start in a separate terminal / process so that the Metro bundler is running. Build will succeed.
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 2
- Comments: 27 (10 by maintainers)
Commits related to this issue
- [expo-updates] Change directory to project root before loading asset manifest - Fixes https://github.com/expo/expo/issues/8374#issuecomment-666640157 — committed to expo/expo by brentvatne 4 years ago
- [expo-updates] Change directory to project root before loading asset manifest - Fixes https://github.com/expo/expo/issues/8374#issuecomment-666640157 — committed to expo/expo by brentvatne 4 years ago
Hey @dondragon2 - we will add a clearer error message here but unfortunately, builds with expo-updates installed do currently require that the metro bundler server is running in another process. The templates from
expo inithave expo-updates preinstalled because we anticipate most users will want this functionality, but you can remove it if needed.If you can customize how you start your build and/or have a separate process running in App Center, it shouldn’t be a problem, but if not, you may need to uninstall expo-updates to get the build to run.
It’s on our roadmap to get builds with expo-updates running without the need for a packager server. But that’s unfortunately not the case right now 😞 Sorry for the trouble!
Ok, basically, I looks like I can’t run a separate process with bundler when using Bitrise. Any workarounds?
@brentvatne I am trying to have my builds automated with AppCenter. Currently AppCebter works fine with a regular react native app. But, with Expo bare it fails with the error above. how would we have metro running in this case or what would be a workaround in this case?
@shubhamdeol - i assume you’re following the guide here? https://reactnative.dev/docs/signed-apk-android#generating-the-release-apk
i think that page should be updated to let users know that they need to have the react-native server running 😃 maybe you could open a PR to clarify that
@dondragon2 Sure. I followed the uninstall guide 100%. Other than that, I did not do anything.
Additional info: my project in question was bootstrapped with create react native app.
Still fails on expo-updates@0.2.14 for me
I’ve been debugging this with @brentvatne via slack.
I’m loading SVGs
to pass to
<SvgXml xml={someSvg} … />. We have the following in ourbabel.config.js:After removing all of the SVG imports the iOS build runs fine.
Edit
Problem resolved with
expo-updates@0.2.13Goes onwards to build the app (for development)
At some point - I am going to assume this is windows related - the node.js (react native) is killed, most likely because a file is being editted by the build process, and when the dev build finishes, the bundler is dead.
(The above is what causes the bundler to die – this issue has been present for longer).
⚠️ this has nothing to do with Admin rights, as in, you can’t solve this by running cmd.exe or powershell in administrative mode. ⚠️
You can still “fix” this flow by just running
react-native startafter your app has started on the device. Kill the app on the devise and start it again.Now the bundler runs, and you can do
gradle bundleRelease.When
gradle bundleReleasekills the bundler (see above), quickly start it again. You usually have about ~1 minute to do this.@sbecker I have also encountered this problem. I solve this problem by updating my expo-update@0.2.0 to expo-updates@0.2.5 expo-updates@0.2.5