React Native官方的测试程序踩坑

React Native官方的测试程序 AwesomePreject可能会出现编译失败


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


React Native官方的测试程序踩坑

React Native官方的测试程序踩坑

可能的原因有:

1.ANDROID_HOME环境变量配置有问题,或者是PATH配置错了;


2.当前使用的SDK版本太低,把

Android SDK Tool,

Android SDK Platform-tools,

Android SDK Build-tools,

Android Support Repository等升级到最高版本;


3.虚拟机(物理机)没有打开,或者没有连接,使用 adb devices命令行可以查看;

前三种可以参考 

http://reactnative.cn/docs/0.47/getting-started.html#content

https://facebook.github.io/react-native/docs/getting-started.html

https://stackoverflow.com/questions/38685267/react-native-android-build


4.文件夹AwesomeProject是只读文件,这种情况是因为在调用react-native init AwesomeProject指令初始化程序的时候,使用的是管理员权限打开的cmd,这种情况下把文件夹AwesomeProject删掉,使用普通模式打开cmd进行操作就可以顺利的运行出结果。

React Native官方的测试程序踩坑

ps:愚蠢的我遇到的是第四种情况

欢迎大家补充遇到的问题,以及解决方法。