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

Nemin Shah picture Nemin Shah · Jun 4, 2013 · Viewed 17.6k times · Source

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?

Answer

Sergey Veselov picture Sergey Veselov · Jun 8, 2013

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>