Error "aapt: not found" when running test

Hoping someone can help…

I have an Appium instance running on Ubuntu 14.04LTS. When I try to execute a test against this I am receiving the following error:

“Problem parsing package and activity from manifest: Error: packageAndLaunchActivityFromManifest failed. Error: Command failed: /bin/sh -c /home/appiumnode/android-sdk-linux/build-tools/23.0.2/aapt dump badging /home/appiumnode/Documents/ConsumerMobile-310-krogerRelease.apk /bin/sh: 1: /home/appiumnode/android-sdk-linux/build-tools/23.0.2/aapt: not found”

What is strange is 4 lines above in the log is an info message stating it is using aapt from /home/appiumnode/android-sdk-linux/build-tools/23.0.2/aapt

I have installed npm via Linuxbrew and not apt-get then installed appium using npm install -g appium.

Any thoughts would be appreciated

Full log info…

2015-11-30 17:13:01:989 - info: Welcome to Appium v1.4.16 (REV ae6877eff263066b26328d457bd285c0cc62430d)
2015-11-30 17:13:01:994 - info: Appium REST http interface listener started on 10.3.165.79:4723
2015-11-30 17:13:02:002 - info: [debug] Non-default server args: {“app”:"/home/appiumnode/Documents/ConsumerMobile-310-krogerRelease.apk",“address”:“10.3.165.79”,“log”:"/home/appiumnode/Documents/node.log",“nodeconfig”:"/home/appiumnode/Documents/androidNode.config"}
2015-11-30 17:13:02:003 - info: Console LogLevel: debug
2015-11-30 17:13:02:004 - info: File LogLevel: debug
2015-11-30 17:13:02:019 - info: [debug] starting auto register thread for grid. Will try to register every 5000 ms.
2015-11-30 17:13:07:284 - info: [debug] Appium successfully registered with the grid on 10.3.161.247:4444
2015-11-30 17:13:12:303 - info: --> GET /wd/hub/status {}
2015-11-30 17:13:12:307 - info: [debug] Responding to client with success: {“status”:0,“value”:{“build”:{“version”:“1.4.16”,“revision”:“ae6877eff263066b26328d457bd285c0cc62430d”}}}
2015-11-30 17:13:12:319 - info: <-- GET /wd/hub/status 200 16.214 ms - 105 {“status”:0,“value”:{“build”:{“version”:“1.4.16”,“revision”:“ae6877eff263066b26328d457bd285c0cc62430d”}}}
2015-11-30 17:13:17:320 - info: --> GET /wd/hub/status {}
2015-11-30 17:13:17:323 - info: [debug] Responding to client with success: {“status”:0,“value”:{“build”:{“version”:“1.4.16”,“revision”:“ae6877eff263066b26328d457bd285c0cc62430d”}}}
2015-11-30 17:13:17:326 - info: <-- GET /wd/hub/status 200 6.138 ms - 105 {“status”:0,“value”:{“build”:{“version”:“1.4.16”,“revision”:“ae6877eff263066b26328d457bd285c0cc62430d”}}}
2015-11-30 17:13:22:325 - info: --> GET /wd/hub/status {}
2015-11-30 17:13:22:326 - info: [debug] Responding to client with success: {“status”:0,“value”:{“build”:{“version”:“1.4.16”,“revision”:“ae6877eff263066b26328d457bd285c0cc62430d”}}}
2015-11-30 17:13:22:328 - info: <-- GET /wd/hub/status 200 2.701 ms - 105 {“status”:0,“value”:{“build”:{“version”:“1.4.16”,“revision”:“ae6877eff263066b26328d457bd285c0cc62430d”}}}
2015-11-30 17:13:27:334 - info: --> GET /wd/hub/status {}
2015-11-30 17:13:27:336 - info: [debug] Responding to client with success: {“status”:0,“value”:{“build”:{“version”:“1.4.16”,“revision”:“ae6877eff263066b26328d457bd285c0cc62430d”}}}
2015-11-30 17:13:27:339 - info: <-- GET /wd/hub/status 200 4.634 ms - 105 {“status”:0,“value”:{“build”:{“version”:“1.4.16”,“revision”:“ae6877eff263066b26328d457bd285c0cc62430d”}}}
2015-11-30 17:13:32:340 - info: --> GET /wd/hub/status {}
2015-11-30 17:13:32:342 - info: [debug] Responding to client with success: {“status”:0,“value”:{“build”:{“version”:“1.4.16”,“revision”:“ae6877eff263066b26328d457bd285c0cc62430d”}}}
2015-11-30 17:13:32:344 - info: <-- GET /wd/hub/status 200 3.475 ms - 105 {“status”:0,“value”:{“build”:{“version”:“1.4.16”,“revision”:“ae6877eff263066b26328d457bd285c0cc62430d”}}}
2015-11-30 17:13:37:348 - info: --> GET /wd/hub/status {}
2015-11-30 17:13:37:350 - info: [debug] Responding to client with success: {“status”:0,“value”:{“build”:{“version”:“1.4.16”,“revision”:“ae6877eff263066b26328d457bd285c0cc62430d”}}}
2015-11-30 17:13:37:353 - info: <-- GET /wd/hub/status 200 4.640 ms - 105 {“status”:0,“value”:{“build”:{“version”:“1.4.16”,“revision”:“ae6877eff263066b26328d457bd285c0cc62430d”}}}
2015-11-30 17:13:42:355 - info: --> GET /wd/hub/status {}
2015-11-30 17:13:42:356 - info: [debug] Responding to client with success: {“status”:0,“value”:{“build”:{“version”:“1.4.16”,“revision”:“ae6877eff263066b26328d457bd285c0cc62430d”}}}
2015-11-30 17:13:42:358 - info: <-- GET /wd/hub/status 200 3.163 ms - 105 {“status”:0,“value”:{“build”:{“version”:“1.4.16”,“revision”:“ae6877eff263066b26328d457bd285c0cc62430d”}}}
2015-11-30 17:13:43:509 - info: --> POST /wd/hub/session {“desiredCapabilities”:{“platformVersion”:“19”,“platform”:“ANDROID”,“deviceName”:“10_Inch_Tablet”,“platformName”:“Android”,“applicationName”:""}}
2015-11-30 17:13:43:512 - info: Client User-Agent string: Apache-HttpClient/4.4.1 (Java/1.8.0_60)
2015-11-30 17:13:43:517 - info: [debug] The following desired capabilities were provided, but not recognized by appium. They will be passed on to any other services running on this server. : platform, applicationName
2015-11-30 17:13:43:524 - info: [debug] No appActivity desired capability or server param. Parsing from apk.
2015-11-30 17:13:43:524 - info: [debug] No appPackage desired capability or server param. Parsing from apk.
2015-11-30 17:13:43:526 - info: [debug] Using local app from command line: /home/appiumnode/Documents/ConsumerMobile-310-krogerRelease.apk
2015-11-30 17:13:43:530 - info: [debug] Creating new appium session dc10e48d-1876-4033-a94c-050ba74257ab
2015-11-30 17:13:43:532 - info: Starting android appium
2015-11-30 17:13:43:537 - info: [debug] Getting Java version
2015-11-30 17:13:43:676 - info: Java version is: 1.7.0_85
2015-11-30 17:13:43:679 - info: [debug] Checking whether adb is present
2015-11-30 17:13:43:682 - info: [debug] Using adb from /home/appiumnode/android-sdk-linux/platform-tools/adb
2015-11-30 17:13:43:682 - info: [debug] Parsing package and activity from app manifest
2015-11-30 17:13:43:684 - info: [debug] Checking whether aapt is present
2015-11-30 17:13:43:685 - info: [debug] Using aapt from /home/appiumnode/android-sdk-linux/build-tools/23.0.2/aapt
2015-11-30 17:13:43:685 - info: [debug] Extracting package and launch activity from manifest.
2015-11-30 17:13:43:688 - info: [debug] executing cmd: /home/appiumnode/android-sdk-linux/build-tools/23.0.2/aapt dump badging /home/appiumnode/Documents/ConsumerMobile-310-krogerRelease.apk
2015-11-30 17:13:43:705 - warn: /bin/sh: 1: /home/appiumnode/android-sdk-linux/build-tools/23.0.2/aapt: not found

2015-11-30 17:13:43:710 - error: Problem parsing package and activity from manifest: Error: packageAndLaunchActivityFromManifest failed. Error: Command failed: /bin/sh -c /home/appiumnode/android-sdk-linux/build-tools/23.0.2/aapt dump badging /home/appiumnode/Documents/ConsumerMobile-310-krogerRelease.apk
/bin/sh: 1: /home/appiumnode/android-sdk-linux/build-tools/23.0.2/aapt: not found

2015-11-30 17:13:43:713 - info: [debug] Cleaning up android objects
2015-11-30 17:13:43:714 - info: [debug] Cleaning up appium session
2015-11-30 17:13:43:718 - error: Failed to start an Appium session, err was: Error: packageAndLaunchActivityFromManifest failed. Error: Command failed: /bin/sh -c /home/appiumnode/android-sdk-linux/build-tools/23.0.2/aapt dump badging /home/appiumnode/Documents/ConsumerMobile-310-krogerRelease.apk
/bin/sh: 1: /home/appiumnode/android-sdk-linux/build-tools/23.0.2/aapt: not found

2015-11-30 17:13:43:725 - info: [debug] Error: packageAndLaunchActivityFromManifest failed. Error: Command failed: /bin/sh -c /home/appiumnode/android-sdk-linux/build-tools/23.0.2/aapt dump badging /home/appiumnode/Documents/ConsumerMobile-310-krogerRelease.apk
/bin/sh: 1: /home/appiumnode/android-sdk-linux/build-tools/23.0.2/aapt: not found

at /home/appiumnode/.linuxbrew/lib/node_modules/appium/node_modules/appium-adb/lib/adb.js:259:19
at ChildProcess.exithandler (child_process.js:210:5)
at emitTwo (events.js:87:13)
at ChildProcess.emit (events.js:172:7)
at maybeClose (internal/child_process.js:818:16)
at Socket.<anonymous> (internal/child_process.js:319:11)
at emitOne (events.js:77:13)
at Socket.emit (events.js:169:7)
at Pipe._onclose (net.js:469:12)

2015-11-30 17:13:43:728 - info: [debug] Responding to client with error: {“status”:33,“value”:{“message”:“A new session could not be created. (Original error: packageAndLaunchActivityFromManifest failed. Error: Command failed: /bin/sh -c /home/appiumnode/android-sdk-linux/build-tools/23.0.2/aapt dump badging /home/appiumnode/Documents/ConsumerMobile-310-krogerRelease.apk\n/bin/sh: 1: /home/appiumnode/android-sdk-linux/build-tools/23.0.2/aapt: not found\n)”,“origValue”:“packageAndLaunchActivityFromManifest failed. Error: Command failed: /bin/sh -c /home/appiumnode/android-sdk-linux/build-tools/23.0.2/aapt dump badging /home/appiumnode/Documents/ConsumerMobile-310-krogerRelease.apk\n/bin/sh: 1: /home/appiumnode/android-sdk-linux/build-tools/23.0.2/aapt: not found\n”},“sessionId”:null}
2015-11-30 17:13:43:734 - info: <-- POST /wd/hub/session 500 224.404 ms - 720
2015-11-30 17:13:47:364 - info: --> GET /wd/hub/status {}
2015-11-30 17:13:47:367 - info: [debug] Responding to client with success: {“status”:0,“value”:{“build”:{“version”:“1.4.16”,“revision”:“ae6877eff263066b26328d457bd285c0cc62430d”}}}
2015-11-30 17:13:47:368 - info: <-- GET /wd/hub/status 200 4.334 ms - 105 {“status”:0,“value”:{“build”:{“version”:“1.4.16”,“revision”:“ae6877eff263066b26328d457bd285c0cc62430d”}}}
2015-11-30 17:13:52:371 - info: --> GET /wd/hub/status {}
2015-11-30 17:13:52:372 - info: [debug] Responding to client with success: {“status”:0,“value”:{“build”:{“version”:“1.4.16”,“revision”:“ae6877eff263066b26328d457bd285c0cc62430d”}}}
2015-11-30 17:13:52:374 - info: <-- GET /wd/hub/status 200 2.759 ms - 105 {“status”:0,“value”:{“build”:{“version”:“1.4.16”,“revision”:“ae6877eff263066b26328d457bd285c0cc62430d”}}}

aapt tool is inside the build tools. Add the path(according to you machine) in environment variable.
D:\Selenium-Data\Eclipse-A\sdk\build-tools\20.0.0\

Thanks for the suggestion. I added the following to my .bashrc but still receive the same message.

export PATH="$HOME/android-sdk-linux/build-tools/23.0.2:$PATH"

Does the file actually exist here? Appium is telling you that it doesn’t, so adding a path to a file that doesn’t exist isn’t going to do much good here.

Try a couple of things:

  1. Find the ‘build-tools’ folder location on your machine. It should be under a directory called ‘android-sdk-linux’ or one called ‘sdk’. Post the entire path
  2. do an ‘echo $ANDROID_SDK_ROOT’ on your command line. Post the result here

Post those 2 paths and I think I can help you fix this.

1 Like

Are you sure that you’ve installed build tools version 23.0.2? Run “android sdk” on the command line. Double check from the window that pops up that build tools version 23.0.2 is installed on your machine. If it’s not, check the checkbox next to that version and then install it.

Hello Guys,

I have solved it by following bellow the steps

-> Open aapium
-> Click on “Edit configurations”
-> Set your android sdk path in the “ANDROID_HOME” variable
-> Click on “Save and Restart”
-> Everything should be worked

Also, you can see the attached screenshot.