Android Hello-World compile error: Intellij cannot find aapt
AndroidIntellij IdeaAndroid Sdk-ToolsAndroid Problem Overview
I'm trying to get set up with an Android development environment using IntelliJ in Ubuntu 12.04. I create an Android Application Module, but when I try to build, I get the following error:
> android-apt-compiler: Cannot run program "/home/jon/Programs/android-sdk-linux/platform-tools/aapt": java.io.IOException: error=2, No such file or directory
Several hours of scouring the internet hasn't helped.
By the way, I ran locate aapt
in the terminal and found that aapt
is located at /home/jon/Programs/android-sdk-linux/build-tools/17.0.0/aapt
Android Solutions
Solution 1 - Android
It appears that the latest update to the r22 SDK release moved aapt and the lib jar from the platform-tools to the build-tools directory. While we wait for JetBrains to release an update, here's a quick fix using a couple of symbolic links:
From your AndroidSDK/platform-tools directory, run the following:
ln -s ../build-tools/17.0.0/aapt aapt
ln -s ../build-tools/17.0.0/lib lib
...and IntelliJ should be able to compile as normal.
Solution 2 - Android
update your IntelliJ to 12.1.4 by using beta releases as the update channel
Solution 3 - Android
In Windows it is enough to copy only aapt.exe
, lib\dx.jar
and dx.bat
from build-tools\android-4.2.2
to
platform-tools
Solution 4 - Android
The same problem occurred for me with android-studio. But, this probably applies to the IntelliJ IDE as well.
When checking the file location I saw, however, that aapt
was in the expected location.
In my case the issue was that I was running a 64-bit Ubuntu linux system which cannot execute the 32-bit aapt
executable.
Installing 32-bit compatibility libraries solved this issue in my case: sudo apt-get install ia32-libs
Solution 5 - Android
i solve it with this to line commands
ln -s ~/Programs/android-sdk-linux/build-tools/17.0.0/aapt ~/Programs/android-sdk-linux/platform-tools/aapt
ln -s ~/Programs/android-sdk-linux/build-tools/17.0.0/lib ~/Programs/android-sdk-linux/platform-tools/lib
Solution 6 - Android
I also noticed it.
ADT has been updated and they added this new build-tools where they moved everything. Intellijidea is not updating paths so it's searching aapt in the old path.
I don't know how to solve it, so let me know if you find a solution...
UPDATE:
I think that you have only 2 options:
- Use Android Build studio: http://developer.android.com/sdk/installing/studio.html
- Copy (this is dirty but works) all content from build-tools/17.0.0/ to platform-tools/ and it will build
Solution 7 - Android
To complain to Jetbrains, go here: http://youtrack.jetbrains.com/issue/IDEA-107311
I reckon more votes will be a faster fix.
Solution 8 - Android
Thanks for the tip! On a mac running the Android 4.2.2 SDK, this worked great. You'll just need to update your paths accordingly. E.g.
ln -s ../build-tools/android-4.2.2/lib lib
ln -s ../build-tools/android-4.2.2/aapt aapt
Solution 9 - Android
I ran into this issue but with android-maven-plugin and as a variant of your item #2 rather than copying the file(s) I simply created a symbolic/soft link for aapt
cd platform-tools
ln -s ../build-tools/17.0.0/aapt ./
This approach seemed to get all my builds functioning again.
Solution 10 - Android
Clone the android-maven-plugin on GitHub and install it in your repo
> git clone https://github.com/jayway/maven-android-plugin.git
> cd .../maven-android-plugin/
> mvn clean install
Then update your pom to use version 3.5.4-SNAPSHOT of the plugin. Everything should work properly !
Solution 11 - Android
I ran these three commands and my problem was resolved
mklink "%ANDROID_HOME%\platform-tools\aapt.exe" "%ANDROID_HOME%\build-tools\17.0.0\aapt.exe"
mklink /D "%ANDROID_HOME%\platform-tools\lib" "%ANDROID_HOME%\build-tools\17.0.0\lib"
mklink "%ANDROID_HOME%\platforms\android-17\tools" "%ANDROID_HOME%\build-tools\17.0.0\aidl.exe"
If you haven't set ANDROID_HOME Environmental variable the replace %ANDROID_HOME% with the path to your android SDK e.g. C:\Android\android-sdk
Solution 12 - Android
On Mac OS you need to
$ cd platform-tools
$ ln -s ../build-tools/android-4.2.2/aapt aapt
$ ln -s ../build-tools/android-4.2.2/lib lib
Solution 13 - Android
Goodlife once again. Just incase of such an error clean project and you are good to go.