7

i am working on andriod development and trying to get the list of activities supported by an APK. Most of the answer that I come across talk about following command:

aapt dump xmltree AndroidManifest.xml

But when I run that command on my command line it throws following error:

aapt is not recognized as an internal or external command

I am able to run other adb commands successfully I am not sure what is wrong with aapt command. On a side note I am doing development in Windows 7 environment.

Yar
  • 7,020
  • 11
  • 49
  • 69
Lost
  • 12,007
  • 32
  • 121
  • 193

4 Answers4

10

That means it is not on your PATH. Please see here for details on how to add Path variables.

Basically here are the steps.

  1. To add or edit anything environment variables in Windows 7, you need to go to System Properties first.
  2. Then, go to “Advanced system settings”
  3. Under “Advanced” tab, click on "Environment Variables …" button at bottom.
  4. Double click PATH and add new path into the "variable value" at the end. Make sure you separate the value with ";"

You'll want to add your platform-tools and tools directories to the PATH so you have the other tools as well.

My paths are as follows: Platform Tools - C:\Program Files\Android\sdk\platform-tools Tools - C:\Program Files\Android\sdk\tools

AAAPT specifically is a Build Tool, so you'll want to add that directory as well. Here's the directory: Build Tools - C:\Program Files\Android\sdk\build-tools\18.1.0

David
  • 7,005
  • 2
  • 22
  • 29
  • OK. I got the part where I have to set the PATH system variable for all the installed apps on my computer IF I want them to be recognizable by my cmd shell. The only thing installed on my computer is Andriod drivers. and adb. Is AAPT a separate tool that I need to install separately before I set the path variable? I see a path variable set for C:\temp\adb on my PC and I think that's the reason why adb command is working successfull – Lost Oct 17 '13 at 18:16
  • 1
    Yeah it's all part of the Android SDK. Open up the SDK Manager and at the top you should see a section called "Tools" I suggest downloading "Android SDK Tools", "Android SDK Platform-tools", and "Android SDK Build-tools" (the latest version). That will get you all of the tools and directories that I talked about in my answer. – David Oct 17 '13 at 19:59
0

To run aapt without specifying the full path, you'll need to add it to your path. The location of that tool on my Windows machine is $ANDROID_SDK\build-tools\17.0.0.

grant
  • 852
  • 1
  • 8
  • 21
0

Your PATH variable does not contain the path to aapt.exe file. This file can be found in SDKFoler/build-tools/18.0.1.

Please add the above mentioned path to your PATH variable and it will work.

Rameshwar
  • 541
  • 6
  • 22
0

Adding Path in environmental Variable solves the issue