第一次开始入手React-Native ,记录一下自己遇到的坑
1.参考网上创建第一个实例(环境配置略),react-native run-android 后报错
app:installDebug
Installing APK 'app-debug.apk' on 'm2 - 5.1'
03:44:04 E/2099056020: Errorwhile uploading app-debug.apk : Unknown failure
Unable to install /path/to/AwesomeProject/android/app/build/outputs/apk/app-debug.apk
com.android.ddmlib.InstallException: Unableto upload some APKs
at com.android.ddmlib.Device.installPackages(Device.java:920)
:app:installDebug FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:installDebug'.
> com.android.builder.testing.api.DeviceException: com.android.ddmlib.InstallException: Unable to upload some APKs
>
- 解决方案:将 android/build.gradle 第 8 行的版本号改成 1.2.3 即可。运行是再输入adb reverse tcp:8081 tcp:8081
2.git clone别人的项目运行是报错:
报错的原因大意就是提示你gradle不对
- 解决方法:我去之前init 的项目中查看了gradle-warpper.properties 下的gradle version ,是gradle-2.4-all.zip
把他复制过来,在下载的项目里,相同的地方改成gradle-2.4-all.zip就可以了。