Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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?

like image 801
Nemin Shah Avatar asked Jun 04 '13 20:06

Nemin Shah


2 Answers

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>
like image 72
Sergey Veselov Avatar answered Oct 26 '22 08:10

Sergey Veselov


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
like image 32
Jordan Avatar answered Oct 26 '22 06:10

Jordan