Question

I've tried every advertised method to specify the path to my Android SDK when trying to build an Android app using the android-maven-plugin, and nothing works. No matter what I do, when I run

mvn clean install

I get

... Could not find tool 'aapt'. Please provide a proper Android SDK directory path as configuration parameter <sdk><path>...</path></sdk> in the plugin <configuration/>. As an alternative, you may add the parameter to commandline: -Dandroid.sdk.path=... or set environment variable ANDROID_HOME.

I set env variable ANDROID_HOME to point to the root directory of the SDK, and exported it. Then

<plugin>
    <groupId>com.jayway.maven.plugins.android.generation2</groupId>
    <artifactId>android-maven-plugin</artifactId>
    ...
    <configuration>
        <sdk>
            <path>${env.ANDROID_HOME}</path>
            <platform>19</platform>
        </sdk>
        ...
    </configuration>
</plugin>

does not work. (and I have API 19 installed in the SDK)

<plugin>
    <groupId>com.jayway.maven.plugins.android.generation2</groupId>
    <artifactId>android-maven-plugin</artifactId>
    ...
    <configuration>
        <sdk>
            <path>/absolute/path/to/sdk</path>
            <platform>19</platform>
        </sdk>
        ...
    </configuration>
</plugin>

does not work

 <properties>
         <android.sdk.path>/absolute/path/to/sdk</android.sdk.path>
 </properties>

Does not work. And

mvn clean install -Dandroid.sdk.path=/absolute/path/to/sdk

Does not work.

I've also tried appending the tools, platform-tools, and build-tools/19.1.1 directories in the SDK to $PATH, and this does not work either. The aapt tool is available on my path, but the maven plugin refuses to see it. I searched the web, and the only advice I see is to do what I've done.

What am I missing? I'm doing this on an OSX system.

Était-ce utile?

La solution

Older versions of Android Maven Plugin might not work with latest SDK. For example support for SDK 22 was added in version 3.6.0. Check changelog.

3.6.0

The plugin has been updated to work with the SDK release 22.0. 21.1 works on the CI server. It might or might not work for older versions.

You don't need to configure ANDROID_HOME inside pom.xml, my working configuration looks like this:

<plugin>
    <groupId>com.jayway.maven.plugins.android.generation2</groupId>
    <artifactId>android-maven-plugin</artifactId>
    <version>3.8.2</version>

    <configuration>
        <sdk>
            <platform>19</platform>
        </sdk>
    </configuration>
</plugin>

Configure ANDROID_HOME properly, for me this points to

.../adt-bundle-linux-x86_64-20131030/sdk/

Make sure it is properly configured, before invoking maven. For example simply run echo $ANDROID_HOME

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top