react-native run-android命令失败,但是gradlew installDebug工作 [英] react-native run-android command failed, but gradlew installDebug work

查看:432
本文介绍了react-native run-android命令失败,但是gradlew installDebug工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在OSX上使用本机0.43.3.我试图在Android上运行应用并收到消息

I'm using react-native 0.43.3 on OSX. I tried to running app on Android and get message

react-native run-android

Scanning 568 folders for symlinks in /Users/ruci.k/project/mayacrew/supermembers/supermembers/node_modules (5ms)
JS server already running.
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

./gradlew installDebug给了我一些错误,并修复了所有问题.最终构建成功,并且应用程序可以在Android设备上运行.

./gradlew installDebug gave me some errors and fixed it all. Finally build get successed and app is working on Android device.

但是 react-native run-android 命令仍然不起作用.仅 ./gradlew installDebug 命令起作用.

But react-native run-android command still not work. Only ./gradlew installDebug command work.

我可以检查使用 react-native run-android 命令吗?

Is there anything can I check to use react-native run-android command?

我不知道怎么回事.

推荐答案

尝试删除android,ios文件夹,然后进行 react-native升级,然后重试 react-native run-android 之后,如果出现类似错误

Try removing android,ios folders and then do react-native upgrade then try again react-native run-android After that if you get an error like

找不到

SDK位置.在local.properties文件中使用sdk.dir或使用ANDROID_HOME环境变量来定义位置.

SDK location not found. Define location with sdk.dir in the local.properties file or with an ANDROID_HOME environment variable.

然后在文件夹内创建一个名为local.properties的文件

then create a file named local.properties inside the folder

android

android

并插入以下行 sdk.dir =/path/to/Android/Sdk 之后,一切应该没问题

and insert the following line sdk.dir =/path/to/Android/Sdk After this everything should be fine

注意:如果您在android/ios文件夹中进行了一些更改,请在删除文件夹之前保留其备份

这篇关于react-native run-android命令失败,但是gradlew installDebug工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆