简体   繁体   English

即使在模拟器运行时,React Native 也无法运行-android

[英]React native fail to run-android even when emulator running

Running the command react-native run-android fails with the following output:运行命令react-native run-android失败,输出如下:

Starting JS server...
Building and installing the app on the device (cd android && ./gradlew installDebug...
Could not install the app on the device, read the error above for details.
Make sure you have an Android emulator running or a device connected and have
set up your Android development environment:
https://facebook.github.io/react-native/docs/android-setup.html

The curious thing about this problem is that an emulator is running.这个问题的奇怪之处在于模拟器正在运行。 adb devices returns adb devices返回

List of devices attached 
emulator-5554   device

If these details help, its running in Linux, with the emulator set as Android 6.0 API Level 23, using Google APIs Intel Atom (x86).如果这些细节有帮助,它在 Linux 上运行,模拟器设置为 Android 6.0 API 级别 23,使用 Google API 英特尔 Atom (x86)。

I had the same issue just last week.上周我遇到了同样的问题。 I tried building the project thru Android Studio.我尝试通过 Android Studio 构建项目。 I think one of the reasons of this error is that, the build looks for the updated (or compatible) version of the Gradle.我认为此错误的原因之一是,构建会寻找 Gradle 的更新(或兼容)版本。 What I did was just let Android Studio be the one to update the gradle on the first build.我所做的只是让 Android Studio 成为在第一次构建时更新 gradle 的人。

After that my app runs and builds without any issues.之后我的应用程序运行和构建没有任何问题。

Hope this helps.希望这会有所帮助。

you might check the permissions on android/gradlew 您可以检查android / gradlew上的权限

they should be 755 not 644 他们应该是755而不是644

run

chmod 755 android/gradlew 

inside your app root folder then open your terminal again and run 在您的应用程序根文件夹中,然后再次打开终端并运行

react-native run-android

and it should work again. 它应该可以再次工作。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 即使连接了 android 设备,React Native run-android 也总是启动模拟器 - React Native run-android always launch emulator even when android device connected npx react-native run-android 不启动模拟器,如果模拟器正在运行则不运行 - npx react-native run-android doesn't start emulator and doesn't run if emulator is running 在 React Native 上运行 run-android 时出错 - Error running run-android on react native 运行 npx react-native run-android 命令时出现 React-native android 错误 - React-native android error when running the npx react-native run-android command react-native run-android未检测到模拟器或设备 - react-native run-android not detecting emulator or device 无法启动模拟器。 原因:模拟器在启动前退出 en React Native when react-native run-android - Failed to launch emulator. Reason: Emulator exited before boot en React Native when react-native run-android React-native run-android在:app:processDebugResources上失败 - React-native run-android fail on :app:processDebugResources 运行 react-native run-android 时,React Native 发布 apk 与应用程序不匹配 - React Native release apk doesn't match app when running react-native run-android 运行react-native run-android时,任务':react-native-icons:compileReleaseAidl'的执行失败 - Execution failed for task ':react-native-icons:compileReleaseAidl' when running react-native run-android 使用 react-native run-android 运行时出现 React-Native 错误 - React-Native error when running with react-native run-android
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM