【已解決】mac上appium報錯:“Could not find aapt Please set the ANDROID_HOME environment variable with the Android SDK root directory path”

來源:互聯網
上載者:User

標籤:UNC   command   too   tools   aging   trycatch   code   rand   dia   

按照網上教程配置完appium環境後,真機跑自動化過程,遇到如下報錯:

appium報錯如下:

[ADB] Checking whether aapt is present[ADB] 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.[ADB] Error: Could not find aapt Please set the ANDROID_HOME environment variable with the Android SDK root directory path.    at Object.wrappedLogger.errorAndThrow (lib/logger.js:60:13)    at ADB.callee$0$0$ (lib/tools/system-calls.js:85:9)    at tryCatch (/Applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:67:40)    at GeneratorFunctionPrototype.invoke [as _invoke] (/Applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:315:22)    at GeneratorFunctionPrototype.prototype.(anonymous function) [as throw] (/Applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:100:21)    at GeneratorFunctionPrototype.invoke (/Applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:136:37)    at run (/Applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/babel-runtime/node_modules/core-js/library/modules/es6.promise.js:104:47)    at /Applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/babel-runtime/node_modules/core-js/library/modules/es6.promise.js:115:28    at flush (/Applications/Appium.app/Contents/Resources/node_modules/appium/node_modules/babel-runtime/node_modules/core-js/library/modules/$.microtask.js:19:5)    at _combinedTickCallback (internal/process/next_tick.js:67:7)    at process._tickCallback (internal/process/next_tick.js:98:9) [Error: Could not find aapt Please set the ANDROID_HOME environment variable with the Android SDK root directory path.] 
首先,使用appium-doctor進行配置檢查

appium-doctor校正結果,ANDROID_HOME等路徑均已經配置:

Last login: Fri Jul  6 23:41:56 on ttys002'/Applications/Appium.app/Contents/Resources/node/bin/node' '/Applications/Appium.app/Contents/Resources/node_modules/appium-doctor/appium-doctor.js'?  ~ '/Applications/Appium.app/Contents/Resources/node/bin/node' '/Applications/Appium.app/Contents/Resources/node_modules/appium-doctor/appium-doctor.js'info AppiumDoctor ### Diagnostic starting ###info AppiumDoctor  ? Xcode is installed at: /Applications/Xcode.app/Contents/Developerinfo AppiumDoctor  ? Xcode Command Line Tools are installed.info AppiumDoctor  ? DevToolsSecurity is enabled.info AppiumDoctor  ? The Authorization DB is set up properly.info AppiumDoctor  ? The Node.js binary was found at: /usr/local/bin/nodeinfo AppiumDoctor  ? HOME is set to: /Users/ucinfo AppiumDoctor  ? ANDROID_HOME is set to: /Users/uc/Library/Android/sdk4eclipseinfo AppiumDoctor  ? JAVA_HOME is set to: /Library/Java/JavaVirtualMachines/jdk1.8.0_144.jdk/Contents/Homeinfo AppiumDoctor  ? adb exists at: /Users/uc/Library/Android/sdk4eclipse/platform-tools/adbinfo AppiumDoctor  ? android exists at: /Users/uc/Library/Android/sdk4eclipse/tools/androidinfo AppiumDoctor  ? emulator exists at: /Users/uc/Library/Android/sdk4eclipse/tools/emulatorinfo AppiumDoctor ### Diagnostic completed, no fix needed. ###info AppiumDoctor info AppiumDoctor Everything looks good, bye!info AppiumDoctor 
其次,檢查環境變數$ANDROID_HOME和aapt,也是OK的。
?  ~ echo $ANDROID_HOME/Users/uc/Library/Android/sdk4eclipse?  lib aaptAndroid Asset Packaging ToolUsage: aapt l[ist] [-v] [-a] file.{zip,jar,apk}   List contents of Zip-compatible archive.
最後,命令後啟動appium解決問題

後來,網上看到一個提問(可惜忘記儲存連結),題主提到他命令後啟動正常,手工啟動appium才有問題。我嘗試使用命令後啟動appium後,問題果然解決。

命令列啟動appium:

/Applications/Appium.app/Contents/MacOS/Appium

【已解決】mac上appium報錯:“Could not find aapt Please set the ANDROID_HOME environment variable with the Android SDK root directory path”

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.