React Native运行的android仅适用于第一次构建



第一次运行我的react原生应用程序时,模拟器可以工作(使用Android Studio Galaxy Nexus(。然而,当我关闭模拟器并重试时,我会得到以下错误:

PS C:Users4cheapexhouseV2> react-native run-android
info Running jetifier to migrate libraries to AndroidX. You can disable it using "--no-jetifier" flag.
Jetifier found 1197 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..
warn Please launch an emulator manually or connect a device. Otherwise app may fail to launch.
info Installing the app...
> Task :app:stripDebugDebugSymbols UP-TO-DATE
Compatible side by side NDK version was not found.
> Task :app:installDebug FAILED
Skipping device 'emulator-5554' (emulator-5554): Device is OFFLINE.
Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/6.2/userguide/command_line_interface.html#sec:command_line_warnings
160 actionable tasks: 2 executed, 158 up-to-date
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:installDebug'.
> com.android.builder.testing.api.DeviceException: No online devices found.
* 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 24s
error Failed to install the app. Make sure you have the Android development environment set up: https://reactnative.dev/docs/environment-setup. Run CLI with --verbose flag for more details.
Error: Command failed: gradlew.bat app:installDebug -PreactNativeDevServerPort=8081

当这种情况发生时,我的模拟器是打开的,并说";未能连接到城域服务器";

这里的内容告诉您问题。

info Launching emulator...
error Failed to launch emulator. Reason: Emulator exited before boot..
warn Please launch an emulator manually or connect a device. Otherwise app may fail to launch.

您的模拟器出现问题。尝试重新启动系统。如果这不起作用,试着制作一个新的模拟器,看看它是否更好。此外,我会关闭模拟器上的Quickstart功能——如果你想保存它的内存状态以加快启动时间,它可能会在你关闭它时询问你。我过去也遇到过类似的问题。

如果这改变了什么,请告诉我。祝你好运

最新更新