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?
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>
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With