新安装最新版本的Appium出现如下错误!

[W3C] Encountered internal error running command: Error: Neither ANDROID_HOME nor ANDROID_SDK_ROOT environment variable was exported. Read https://developer.android.com/studio/command-line/variables for more details
[W3C]     at requireSdkRoot (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/appium-adb/lib/helpers.js:36:11)
[W3C]     at Function.createADB (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/appium-adb/lib/adb.js:66:23)
[W3C]     at Object.createBaseADB (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/appium-android-driver/lib/android-helpers.js:107:20)
[W3C]     at Object.getDeviceInfoFromCaps (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/appium-android-driver/lib/android-helpers.js:191:29)
[W3C]     at AndroidUiautomator2Driver.startUiAutomator2Session (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/appium-uiautomator2-driver/lib/driver.js:310:40)
[W3C]     at AndroidUiautomator2Driver.createSession (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/appium-uiautomator2-driver/lib/driver.js:221:18)
[W3C]     at processTicksAndRejections (internal/process/task_queues.js:85:5)
[W3C]     at AppiumDriver.createSession (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/lib/appium.js:358:35)
[W3C] Destroying socket connection
[HTTP] <-- POST /wd/hub/session 500 410 ms - 879

解决办法:

\2020060915364544.png

如果ANDROID_HOME环境变量这里出现的是空白页面,那么建议你重新配置,或者直接把对应的路径填上去,然后save and restart即可

配置方法参考:

原创文章,转载请注明 :Appium 下配置ANDROID_HOME和JAVA_HOME环境变量 - pytorch中文网
原文出处: https://ptorch.com/news/258.html
问题交流群 :168117787

发表评论

邮箱地址不会被公开。 必填项已用*标注