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

前端 未结 6 519
春和景丽
春和景丽 2021-02-01 23:30

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.jay

相关标签:
6条回答
  • 2021-02-02 00:09

    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>
    
    0 讨论(0)
  • 2021-02-02 00:11

    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
    
    0 讨论(0)
  • 2021-02-02 00:15

    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.

    0 讨论(0)
  • 2021-02-02 00:23

    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>
    
    0 讨论(0)
  • 2021-02-02 00:29

    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

    0 讨论(0)
  • 2021-02-02 00:30

    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>
    
    0 讨论(0)
提交回复
热议问题