[英]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.