Android Uiautomator2 gradlew 坑
安装错误: Gradle 的编译版本过高, 不兼容部分5.0+手机, 需要降低版本为 1.3.
Installing APK 'app-debug.apk' on 'HUAWEI GRA-TL00 - 5.0.1' for app:debug
Error while uploading app-debug.apk : Unknown failure ([CDS]close[0])
使用AndroidStudio安装的时候,IDE提供了app运行时需要的权限,所以直接使用Debug就可以安装。而使用react-native run-android有这样的问题是因为没有获得权限,所以没法往真机上装应用。
有两种解决办法,一是降低gradle的build版本,改为1.2.3;另一种是升级你的React-Native至最新版本。
打开 React Native 的项目, 修改最外层工程的 build.gradle 配置, 降低 gradle 的 build 为1.2.3版本.
buildscript {
repositories {
jcenter()
mavenLocal()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.2.3' // 修改1.2.3
classpath 'de.undercouch:gradle-download-task:2.0.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
这个时候还是会报错,需要重新设置 Gradle 的 Wrapper , 修改为2.2版本.
Gradle version 2.2 is required. Current version is 2.11
修改Gradle的Wrapper版本,需要修改android/griddle/wrapper/grade-wrapper.properties文件:
distributionUrl=https\://services.gradle.org/distributions/gradle-2.2-all.zip
更多错误
http://blog.csdn.net/woxueliuyun/article/details/54562126
http://cache.baiducontent.com/c?m=9d78d513d9921cf04fece4690d61c0676907dc357c8a8b4368d5e35f93134c403736a4e079744744c4c40c7001d85e5d9ab6613371587ce28cc9f85dddcc85295fdb656f671df65612a40eaebb1072857bc10dfeae69b0f0a165d1e8898e834352ba44040997f0fa0b5d4bdd6e80033194b19838460346fab06b33e858073e9f5457b737afb66d305cd1e1dc2c5bc35dc76061ccf374f66d4ceb44e40b5c641aaf16f74e13313193523aaf1a605185eb2ab66b2f1c34b63fefee87abb41bce8cb76c85a98be974c43eb1d8bcae37112b0cbb38b9aabbb1366e4408&p=81759a46d6c11bb102f1c7710f4989&newp=882a9645d48b05fc57efdc21424a97231610db2151d4d0176b82c825d7331b001c3bbfb42324120ed1c1786700a94c5ee8f73679330727a3dda5c91d9fb4c57479c063&user=baidu&fm=sc&query=com%2Eandroid%2Ebuilder%2Etesting%2Eapi%2EDeviceException%3A+com%2Eandroid%2Eddmlib%2EInstallException%3A+Failed+to+establish+session&qid=f2d8006f0001c34f&p1=1