Could not find tool aapt. Please provide proper Android SDK directory path as configuration parameter
Asked Answered
L

6

14

I am trying to build a android project using maven. But when I run : mvn clean install I get the following error:

Execution default-generate-sources of goal com.jayway.maven.plugins.android.generation2:android-maven-plugin:3.4.1:generate- sources failed: Could not find tool 'aapt'. Please provide a proper Android SDK directory path as configuration parameter <\sdk><\path>...</path></sdk> in the plugin . As an alternative, you may add the parameter to commandline: -Dandroid.sdk.path=... or set environment variable ANDROID_HOME. -> [Help 1]

I have set my ANDROID_HOME to the sdk directory. What can be the problem here?

Lula answered 4/6, 2013 at 20:54 Comment(0)
M
39

In the last release of android sdk directory structure has changed. Build tools like aapt or dex has been moved from platform-tools to build-tools directory. Support for new directory structure was added in maven-android-plugin version 3.6.0 but you use version 3.4.1. Changing plugin version to 3.6.0 in pom.xml must help. Here is snippet from my pom.xml:

        <plugin>
            <groupId>com.jayway.maven.plugins.android.generation2</groupId>
            <artifactId>android-maven-plugin</artifactId>
            <version>3.6.0</version>
            <configuration>
                <androidManifestFile>src/main/other/AndroidManifest.xml</androidManifestFile>
                <resourceDirectory>src/main/resources</resourceDirectory>
                <sourceDirectory>src/main/java</sourceDirectory>
                <sdk>
                    <platform>17</platform>
                    <path>/opt/android-sdk/</path>
                </sdk>
                <manifest>
                    <debuggable>true</debuggable>
                </manifest>
            </configuration>
            <extensions>true</extensions>
        </plugin>
Ministerial answered 8/6, 2013 at 9:33 Comment(3)
For me mentioning the platform version isn't necessary (but upgrading to 3.6.0 is).Menispermaceous
you nailed it! upgrading to 3.6.0 helpedTerrence
Just adding the version as 3.6.0 in my pom.xml file has solved the issue for me.Wendish
A
7

If you are using android version 17, you might want to try this documented workaround (i.e. I did not find it myself).

cd <android-sdk>/platform-tools
ln -s ../build-tools/17.0.0/aapt aapt
ln -s ../build-tools/17.0.0/lib lib
Amulet answered 5/6, 2013 at 10:10 Comment(1)
I found the solution. Its not the perfect one but it worked. I just copied all the files in the build-tools folder and copied in into the tools folder in the Android SDK directory. (Do not replace the existing files)Lula
D
3

The correct solution is documented in the changelog for version 3.6.0

Just add the sdk platform configuration to the Android Maven Plugin like so

<configuration>
  <sdk> 
    <platform>17</platform>
   </sdk>
</configuration>
Durban answered 5/6, 2013 at 18:31 Comment(0)
G
1

in your pom.xml file,specify the path to your android sdk

        <plugin>
            <groupId>com.jayway.maven.plugins.android.generation2</groupId>
            <artifactId>android-maven-plugin</artifactId>
            <version>3.5.1</version>
            <extensions>true</extensions>
            <configuration>
                <sdk>
                    <path>${ANDROID_HOME}</path>
                    <platform>16</platform>
                </sdk>
            </configuration>
        </plugin>
Gabel answered 12/6, 2013 at 13:10 Comment(1)
The environment variable ANDROID_HOME is used anyway, so mentioning the path here is redundant...Menispermaceous
P
0

If android sdk version above 21, just add %ANDROID_HOME%/build-tools to to environment variable PATH of your system.

to "Nemin Shah" -- copy files is not such good idea.

Paredes answered 17/6, 2013 at 11:30 Comment(0)
K
0

I get stuck with the same problem. Finally i managed to resolve the issue after two hours. To make it simple and resolve the issue in 5 minutes i listed the steps below

Step 1 - In Eclipse update your Android Maven Plugin to 0.4.3.2013 using the beta release link http://rgladwell.github.io/m2e-android/updates/master/

Step 2

     <plugin>
        <groupId>com.jayway.maven.plugins.android.generation2</groupId>
        <artifactId>android-maven-plugin</artifactId> 
        <version>3.6.1</version>
        <configuration>
            <sdk>
                <platform>17</platform>
            </sdk> 
        </configuration>
    </plugin>

It will solve the following issues

"No Android Platform Version/API Level has been configured"

Could not find tool 'aapt'

Hope it helps

Kossuth answered 18/9, 2013 at 12:3 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.