Appium 执行报 ERROR: No suitable Java found.

[ADB] apksigner stdout: 
[ADB] ERROR: No suitable Java found. In order to properly use the Android Developer
[ADB] Tools, you need a suitable version of Java JDK installed on your system.
[ADB] We recommend that you install the JDK version of JavaSE, available here:
[ADB]   http://www.oracle.com/technetwork/java/javase/downloads
[ADB] 
[ADB] If you already have Java installed, you can define the JAVA_HOME environment
[ADB] variable in Control Panel / System / Avanced System Settings to point to the
[ADB] JDK folder.
[ADB] 
[ADB] You can find the complete Android SDK requirements here:
[ADB]   http://developer.android.com/sdk/requirements.html

uiautomatorviewer 运行也报类似的错

解决方法

如果安装的 JDK 版本在 9 或者更高,因为 JDK 不再提供 JRE 导致 Appium 和 uiautomatorviewer 会因为找不到 jdk 目录下的 jre 而报上述的错误,如果有装 Android Studio 的话可以直接环境变量中配置一下 Android Studio 自带的 jre,默认路径如下:

C:\Program Files\Android\Android Studio\jre\bin

这样就不会报错了,当然你也可以直接安装或者生成一个 jre,百度一下都有方法


↙↙↙阅读原文可查看相关链接,并与作者交流