问题 1、用例执行过程中,appium 报找不到 aapt
appium 日志信息如下:
> info: <-- POST /wd/hub/session 500 13133.363 ms - 756
> error: Failed to start an Appium session, err was: Error: Could not find aapt in tools, platform-tools, or supported build-tools under "C:\apache\adt-bundle-windows-x86_64-20140702\sdk"; do you have android SDK or build-tools installed into this location? Supported build tools are: 17.0.0, 18.0.1, 19.0.0, 19.0.1, 19.1.0, 20.0.0, android-4.2.2, android-4.3, android-4.4
> debug: Error: Could not find aapt in tools, platform-tools, or supported build-tools under "C:\apache\adt-bundle-windows-x86_64-20140702\sdk"; do you have android SDK or build-tools installed into this location? Supported build tools are: 17.0.0, 18.0.1, 19.0.0, 19.0.1, 19.1.0, 20.0.0, android-4.2.2, android-4.3, android-4.4
> at ADB.checkSdkBinaryPresent (D:\Appium\node_modules\appium\node_modules\appium-adb\lib\adb.js:103:10)
> at ADB.checkAaptPresent (D:\Appium\node_modules\appium\node_modules\appium-adb\lib\adb.js:142:8)
> at ADB.packageAndLaunchActivityFromManifest (D:\Appium\node_modules\appium\node_modules\appium-adb\lib\adb.js:235:8)
> at androidCommon.packageAndLaunchActivityFromManifest (D:\Appium\node_modules\appium\lib\devices\android\android-common.js:672:12)
> at D:\Appium\node_modules\appium\node_modules\async\lib\async.js:610:21
> at D:\Appium\node_modules\appium\node_modules\async\lib\async.js:249:17
> at iterate (D:\Appium\node_modules\appium\node_modules\async\lib\async.js:149:13)
> at D:\Appium\node_modules\appium\node_modules\async\lib\async.js:160:25
> at D:\Appium\node_modules\appium\node_modules\async\lib\async.js:251:21
> at D:\Appium\node_modules\appium\node_modules\async\lib\async.js:615:34
> debug: Responding to client with error: {"status":33,"value":{"message":"A new session could not be created. (Original error: Could not find aapt in tools, platform-tools, or supported build-tools under \"C:\\apache\\adt-bundle-windows-x86_64-20140702\\sdk\"; do you have android SDK or build-tools installed into this location? Supported build tools are: 17.0.0, 18.0.1, 19.0.0, 19.0.1, 19.1.0, 20.0.0, android-4.2.2, android-4.3, android-4.4)","origValue":"Could not find aapt in tools, platform-tools, or supported build-tools under \"C:\\apache\\adt-bundle-windows-x86_64-20140702\\sdk\"; do you have android SDK or build-tools installed into this location? Supported build tools are: 17.0.0, 18.0.1, 19.0.0, 19.0.1, 19.1.0, 20.0.0, android-4.2.2, android-4.3, android-4.4"},"sessionId":null}
解决方法:
将 adt-bundle-windows-x86_64-20140702\sdk\build-tools\android-4.4W 目录下的 aapt.exe 拷贝到 adt-bundle-windows-x86_64-20140702\sdk\tools 目录下
问题 2、用例执行过程中,appium 报找不到 zipalign
> error: Failed to start an Appium session, err was: Error: Could not find zipalign in tools, platform-tools, or supported build-tools under "C:\apache\adt-bundle-windows-x86_64-20140702\sdk"; do you have android SDK or build-tools installed into this location? Supported build tools are: 17.0.0, 18.0.1, 19.0.0, 19.0.1, 19.1.0, 20.0.0, android-4.2.2, android-4.3, android-4.4
> debug: Error: Could not find zipalign in tools, platform-tools, or supported build-tools under "C:\apache\adt-bundle-windows-x86_64-20140702\sdk"; do you have android SDK or build-tools installed into this location? Supported build tools are: 17.0.0, 18.0.1, 19.0.0, 19.0.1, 19.1.0, 20.0.0, android-4.2.2, android-4.3, android-4.4
> at ADB.checkSdkBinaryPresent (D:\Appium\node_modules\appium\node_modules\appium-adb\lib\adb.js:103:10)
> at ADB.checkZipAlignPresent (D:\Appium\node_modules\appium\node_modules\appium-adb\lib\adb.js:146:8)
> at ADB.zipAlignApk (D:\Appium\node_modules\appium\node_modules\appium-adb\lib\adb.js:452:8)
> at null.<anonymous> (D:\Appium\node_modules\appium\node_modules\appium-adb\lib\adb.js:491:10)
> at ChildProcess.exithandler (child_process.js:635:7)
> at ChildProcess.EventEmitter.emit (events.js:98:17)
> at maybeClose (child_process.js:743:16)
> at Process.ChildProcess._handle.onexit (child_process.js:810:5)
> debug: Responding to client with error: {"status":33,"value":{"message":"A new session could not be created. (Original error: Could not find zipalign in tools, platform-tools, or supported build-tools under \"C:\\apache\\adt-bundle-windows-x86_64-20140702\\sdk\"; do you have android SDK or build-tools installed into this location? Supported build tools are: 17.0.0, 18.0.1, 19.0.0, 19.0.1, 19.1.0, 20.0.0, android-4.2.2, android-4.3, android-4.4)","origValue":"Could not find zipalign in tools, platform-tools, or supported build-tools under \"C:\\apache\\adt-bundle-windows-x86_64-20140702\\sdk\"; do you have android SDK or build-tools installed into this location? Supported build tools are: 17.0.0, 18.0.1, 19.0.0, 19.0.1, 19.1.0, 20.0.0, android-4.2.2, android-4.3, android-4.4"},"sessionId":null}
解决方法:
将 adt-bundle-windows-x86_64-20140702\sdk\build-tools\android-4.4W 目录下的 zipalign.exe 拷贝到 adt-bundle-windows-x86_64-20140702\sdk\tools 目录下