Android Hello-World compile error: Intellij cannot find aapt

痞子三分冷 提交于 2019-11-27 10:59:17

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.

update your IntelliJ to 12.1.4 by using beta releases as the update channel

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

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

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

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:

1) Use Android Build studio: http://developer.android.com/sdk/installing/studio.html 2) Copy (this is dirty but works) all content from build-tools/17.0.0/ to platform-tools/ and it will build

To complain to Jetbrains, go here: http://youtrack.jetbrains.com/issue/IDEA-107311

I reckon more votes will be a faster fix.

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

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.

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 !

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

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

Goodlife once again. Just incase of such an error clean project and you are good to go.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!