Appium ANDROID_HOME 环境变量问题 [英] Appium ANDROID_HOME env variable issues

查看:71
本文介绍了Appium ANDROID_HOME 环境变量问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

祝大家新年快乐,如果有人能帮助或解决这个问题,我将不胜感激.

Happy new year all, I'd gratefully appreciate if someone could help or shed some light into this issue.

我刚刚在 MAC OS High Sierra v 10.13.2 上设置了 appium 1.7.2 服务器,通过以下命令运行 appium.appium -a 127.0.0.1 -p 4723 --log-level=debug

I've just set up appium 1.7.2 server on MAC OS High Sierra v 10.13.2, running appium through below command. appium -a 127.0.0.1 -p 4723 --log-level=debug

下面是我的 .bash_profile

n.nadarajah@EGHJ-MACRDV01 ~ $ cat ~/.bash_profile
# Setting PATH for Python 2.7
# The original version is saved in .bash_profile.pysave
ANDROID_HOME=/Users/n.nadarajah/Library/Android/sdk
JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_151.jdk/Contents/Home
ANDROID_PLATFORM_TOOLS=$ANDROID_HOME/platform-tools
ANDROID_TOOLS=$ANDROID_HOME/tools
PATH="/Library/Frameworks/Python.framework/Versions/2.7/bin:${PATH}:$JAVA_HOME:$ANDROID_HOME:
$ANDROID_PLATFORM_TOOLS:$ANDROID_TOOLS"
export PATH

<小时>

回显 $ANDRIOD_HOME 环境变量

n.nadarajah@EGHJ-MACRDV01 ~ $ echo $ANDROID_HOME
/Users/n.nadarajah/Library/Android/sdk

<小时>

以下是测试执行的 Appium 日志.

n.nadarajah@EGHJ-MACRDV01 ~ $ appium -a 127.0.0.1 -p 4723 --log-l . 
level=debug
info: Welcome to Appium v1.4.16 (REV 
ae6877eff263066b26328d457bd285c0cc62430d)
info: Appium REST http interface listener started on 127.0.0.1:4723
info: [debug] Non-default server args: {"address":"127.0.0.1"}
info: Console LogLevel: debug
info: --> POST /wd/hub/session {"capabilities":{"alwaysMatch":
{"platformName":"Android"},"firstMatch":
[{}]},"desiredCapabilities":{"deviceName":"Android 
Emulator","app":"/Users/n.nadarajah/sites/Resilient-
QA/EndToEndTesting/apks/app-
debug.apk","platformName":"Android","automationName":"appium",
"appPackage":"com.resilientplc.smartnumbers.debug"}}
info: Client User-Agent string: Python http auth
info: [debug] No appActivity desired capability or server param. 
Parsing from apk.
info: [debug] Using local app from desired caps: 
/Users/n.nadarajah/sites/Resilient-QA/EndToEndTesting
/apks/app-debug.apk
info: [debug] Creating new appium session 
a5cfbee9-bcd6-41af-a90c-0389ab244d2c
info: Starting android appium
info: [debug] Getting Java version
info: Java version is: 1.8.0_151
info: [debug] Checking whether adb is present
warn: The ANDROID_HOME environment variable is not set to the Android 
SDK root directory path. 
ANDROID_HOME is required for compatibility with SDK 23+. 
Checking along PATH for adb.
info: [debug] executing cmd: which adb
info: [debug] Using adb from /Users/n.nadarajah/
Library/Android/sdk/platform-tools/adb
info: [debug] Parsing package and activity from app manifest
info: [debug] Checking whether aapt is present
warn: The ANDROID_HOME environment variable is not set to the Android 
SDK root directory path. 
ANDROID_HOME is required for compatibility with SDK 23+. 
Checking along PATH for aapt.
info: [debug] executing cmd: which aapt
error: Problem parsing package and activity from manifest: Error: Could 
not find aapt. Please set the ANDROID_HOME environment 
variable with the Android SDK root directory path.
info: [debug] Cleaning up android objects
info: [debug] Cleaning up appium session
error: Failed to start an Appium session, err was: Error: Could not 
find aapt. Please set the ANDROID_HOME environment variable 
with the Android SDK root directory path.
info: [debug] Error: Could not find aapt. 
Please set the ANDROID_HOME environment variable with the 
Android SDK root directory path.at ADB.<anonymous> 
(/usr/local/lib/node_modules/appium
/node_modules/appium-adb/lib/adb.js:126:12)
    at ChildProcess.exithandler (child_process.js:279:5)
    at ChildProcess.emit (events.js:159:13)
    at maybeClose (internal/child_process.js:943:16)
    at Socket.stream.socket.on (internal/child_process.js:363:11)
    at Socket.emit (events.js:159:13)
    at Pipe._handle.close [as _onclose] (net.js:568:12)
info: [debug] Responding to client with error: {"status":33,"value":
{"message":"A new session could not be created. 
(Original error: Could not find aapt. Please set the ANDROID_HOME 
environment variable with the Android SDK root 
directory path.)","origValue":"Could not find aapt. Please set the 
ANDROID_HOME environment variable with the 
Android SDK root directory path."},"sessionId":null}
info: <-- POST /wd/hub/session 500 164.317 ms - 344

<小时>

问题:1、为什么appium看不到系统环境变量?


Questions: 1. Why does appium cannot see the system environment variable?

我已经尝试过 appium 服务器版本 1.7.2 &1.7.1 &1.6.2 &1.4.16 症状相同.有人能帮我解决这个问题吗.

I've tried appium server versions 1.7.2 & 1.7.1 & 1.6.2 & 1.4.16 the symptoms were the same. Could someone help me out with this please.

谢谢尼罗

推荐答案

我已经找到了这个问题的根源,结果我错过了另一个 android 环境变量.

I've got to the bottom of this issue, turns out I've missed another android env variable.

在上述情况下,我错过了ANDROID_BUILD_TOOLS

In the above case I've missed ANDROID_BUILD_TOOLS

在撰写本文时,以下是 appium 所需的环境变量列表.

At the point of writing this, below are the list of Env variables required for appium.

ANDROID_HOME=/Users/n.nadarajah/Library/Android/sdk
JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_151.jdk/
Contents/Home/bin
ANDROID_PLATFORM_TOOLS=$ANDROID_HOME/platform-tools
ANDROID_TOOLS=$ANDROID_HOME/tools
ANDROID_BUILD_TOOLS=$ANDROID_HOME/build-tools/27.0.3

将上述所有环境变量附加到 $PATH

Append all the above env variables to $PATH

这篇关于Appium ANDROID_HOME 环境变量问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆