[英]Failed to launch emulator. Reason: Emulator exited before boot en React Native when react-native run-android
I am installing React Native according to this website https://medium.com/@leonardobrunolima/react-native-tips-setting-up-your-development-environment-for-windows-d326635604ea , it's very useful until I run the command react-native run-android
, this is the error I receive:我正在根据这个网站https://medium.com/@leonardobrunolima/react-native-tips-setting-up-your-development-environment-for-windows-d326635604ea安装 React Native,在我运行命令之前它非常有用
react-native run-android
,这是我收到的错误:
info Running jetifier to migrate libraries to AndroidX. You can disable it using "--no-jetifier" flag.
Jetifier found 864 file(s) to forward-jetify. Using 8 workers...
info Starting JS server...
info Launching emulator...
error Failed to launch emulator. Reason: Emulator exited before boot..
> Task :app:transformNativeLibsWithMergeJniLibsForDebug FAILED
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.5/userguide/command_line_interface.html#sec:command_line_warnings
24 actionable tasks: 4 executed, 20 up-to-date
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:transformNativeLibsWithMergeJniLibsForDebug'.
> Could not read path 'C:\JesusApp\android\app\build\intermediates\transforms\mergeJniLibs\debug\0\lib\x86_64'.
* 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
BUILD FAILED in 7s
error Failed to install the app. Make sure you have the Android development environment set up: https://facebook.github.io/react-native/docs/getting-started.html#android-development-environment. Run CLI with --verbose flag for more details.
Error: Command failed: gradlew.bat app:installDebug -PreactNativeDevServerPort=8081
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:transformNativeLibsWithMergeJniLibsForDebug'.
> Could not read path 'C:\JesusApp\android\app\build\intermediates\transforms\mergeJniLibs\debug\0\lib\x86_64'.
* 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
BUILD FAILED in 7s
at checkExecSyncError (child_process.js:629:11)
at execFileSync (child_process.js:647:13)
at runOnAllDevices (C:\JesusApp\node_modules\@react-native-community\cli-platform-android\build\commands\runAndroid\runOnAllDevices.js:94:39)
at process._tickCallback (internal/process/next_tick.js:68:7)
My node version is 10, and I am working on Windows, please help, thank you.我的node版本是10,我在windows下工作,请帮忙,谢谢。
android/gradle/wrapper/gradle-wrapper.properties
android/gradle/wrapper/gradle-wrapper.properties
Finally, I got it up and running both on Windows 10 and Ubuntu 20.04 LTS with Android 30.最后,我在 Windows 10 和带有 Android 30 的 Ubuntu 20.04 LTS 上启动并运行了它。
我通过执行以下步骤成功:打开 android studio > AVD Manager > Actions(单击底部图标)> Select Cool Boot Now。
First start the android emulator on Android Studio, then execute the react-native run-android.首先在Android Studio上启动android模拟器,然后执行react-native run-android。 If it doesn´t work go to android studio and do "Build -> Clean Project"
如果它不起作用,请转到 android studio 并执行“Build -> Clean Project”
In my case, I've to wipe data on the virtual device.就我而言,我必须擦除虚拟设备上的数据。 Android Studio -> AVD -> Actions (↓) -> Wipe Data
Android Studio -> AVD -> 操作 (↓) -> 擦除数据
I faced similar problem when executing my react-native code on Android Physical device.在Android 物理设备上执行我的 react-native 代码时,我遇到了类似的问题。 I am not sure if my solution will help.
我不确定我的解决方案是否会有所帮助。
We all know that ADB requires authorization from an Android device in order to communicate with it.我们都知道 ADB 需要 Android 设备的授权才能与其通信。 It's only by allowing the USB debugging and validating the computer's RSA key fingerprint that we let the ADB daemon connect to our phone and control it.
只有通过允许 USB 调试和验证计算机的 RSA 密钥指纹,我们才能让 ADB 守护程序连接到我们的手机并控制它。 This is a security feature.
这是一项安全功能。
My phone was connected with USB and on changing USB Configuration on device, my phone gave me another prompt "Allow USB debugging?"我的手机已通过 USB 连接,并且在更改设备上的 USB 配置时,我的手机给了我另一个提示“允许 USB 调试?” Image available for reference .
图片可供参考。 I got solution on reallow USB debugging
我得到了关于真正的USB 调试的解决方案
我遇到了同样的问题,只检查开发人员选项并在设备上通过usb启用调试
For me, the problem ended up being quite simple.对我来说,问题最终变得非常简单。 Working in react-native, I was running the following command from the terminal 'npx react-native run-android' in VS CODE.
在 react-native 中工作,我从 VS CODE 中的终端“npx react-native run-android”运行以下命令。 Though the emulator would run fine when started from Android Studios, I received the above error when running from the terminal in VS Code.
虽然模拟器从 Android Studios 启动时运行良好,但在 VS Code 中从终端运行时收到上述错误。
Solution: Run VS Code as Administrator.解决方案:以管理员身份运行 VS Code。 (or your terminal in general)
(或您的一般终端)
为我工作-磁盘上没有足够的空间,检查磁盘上是否有足够的空间(模拟器安装在哪里)。
This might be the insufficient space in your machine or AVD or the mismatch in the configurations.这可能是您的机器或 AVD 中的空间不足或配置不匹配。
So, do the following steps to resolve this issue.因此,请执行以下步骤来解决此问题。
Build -> Clean Project
Build -> Clean Project
Open android studio > AVD Manager > Actions (click the bottom icon) > Select Cool Boot Now
.Open android studio > AVD Manager > Actions (click the bottom icon) > Select Cool Boot Now
来清理 AVD。In my case, cool boot and wipe data didn't work.就我而言,冷启动和擦除数据不起作用。 I just uninstall the virtual device and reinstall it and then it works for me.
我只是卸载虚拟设备并重新安装它,然后它对我有用。
为我工作 - 重新加载系统或清理系统/android缓存./android/avd
For me running对我来说跑步
adb kill-server
and和
adb start-server
worked工作过
I also runned killall 9 node
before that but it was not enough.在此之前我也运行了
killall 9 node
,但这还不够。 MacOS asks for saving last state before restart also Android emulator asks before quiting it. MacOS 要求在重启之前保存最后一个状态,Android 模拟器也会在退出之前询问。 Maybe the problem happens because saving a bad state and trying to start from that bad state.
也许问题的发生是因为保存了一个糟糕的状态并试图从那个糟糕的状态开始。 Not sure but I suspect one of these.
不确定,但我怀疑其中之一。
删除文件app\build\intermediates\signing_config\debug\out\signing-config.json
对我有用。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.