Android Maven Could not find tool 'aapt'

后端 未结 6 1280
青春惊慌失措
青春惊慌失措 2020-12-12 15:34

i was trying to follow this tutorial:

http://www.gdgankara.org/2012/11/01/step-by-step-android-development-with-maven/

but after setting up the environment,

相关标签:
6条回答
  • 2020-12-12 16:06

    I also encountered the same problem when using latest ADT from google and trying to compile the bootstrap android platform.

    The latest r17 build separate out aapt to build-tools folder. Hence it is maven-android-plugin cannot support it.

    See issue discussed here.

    Tried and working:

    cd $ANDROID_HOME/platform-tools
    ln -s ../build-tools/android-4.2.2/aapt aapt
    ln -s ../build-tools/android-4.2.2/lib lib
    ln -s ../build-tools/android-4.2.2/aidl aidl
    

    Some installations may be structured using the API version:

    cd $ANDROID_HOME/platform-tools
    ln -s ../build-tools/17.0.0/aapt aapt
    ln -s ../build-tools/17.0.0/lib lib
    ln -s ../build-tools/17.0.0/aidl aidl
    

    Keep in mind that this is fixed in the latest version (>3.5.3) of the Android Maven Plugin, as other answers point out.

    0 讨论(0)
  • 2020-12-12 16:12

    I'm using macOS 10.14 and in my case:

    I download Android packaging tool from AAPT and then copied all the files into
    $ANDROID_HOME/platforms/$SDK/tools/


    DON'T REMIND CHANGE $SDK WITH YOUR REAL NAME SDK FOR INSTANCE android-29

    0 讨论(0)
  • 2020-12-12 16:13

    I too had similar problems.

    Solved by following steps :

    1) Upgrade maven to 3.1.1 2) Use android-maven-plugin 3.6.1 pr greater [I used 3.8.0] 3) Use maven-dependency-plugin 2.8

    If you want to build against latest Android SDK [ex : 4.3], follow following additional steps - 4) Install the local copy of android.jar using command mvn install:installFile .. 5) Set 18

    Hope this helps.

    0 讨论(0)
  • 2020-12-12 16:16

    If you are using Windows, the symbolic linking can be done using mklink command.

    D:\>cd "Program Files (x86)\Android\android-sdk"
    
    D:\Program Files (x86)\Android\android-sdk>cd platform-tools
    
    D:\Program Files (x86)\Android\android-sdk\platform-tools>mklink aapt.exe ..\build-tools\17.0.0\aapt.exe
    symbolic link created for aapt.exe <<===>> ..\build-tools\17.0.0\aapt.exe
    
    D:\Program Files (x86)\Android\android-sdk\platform-tools>mklink aidl.exe ..\build-tools\17.0.0\aidl.exe
    symbolic link created for aidl.exe <<===>> ..\build-tools\17.0.0\aidl.exe
    
    D:\Program Files (x86)\Android\android-sdk\platform-tools>mklink /d lib ..\build-tools\17.0.0\lib
    symbolic link created for lib <<===>> ..\build-tools\17.0.0\lib
    
    0 讨论(0)
  • 2020-12-12 16:26

    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)
  • 2020-12-12 16:28

    Update:

    This has been resolved since Android Maven Plugin v3.6.0. For now you will only need these symlinks if you use IntelliJ v12.x. IntelliJ v13 EAP+ should work out of the box.

    Original answer:

    This has been fixed and will be released with Android Maven Plugin v3.5.4. See the github pull request:

    Upgraded AndroidSdk to use path and platform utilities from sdklib

    You can try validating the snapshot build which contains the fix by adding the following to your pom.xml:

    <plugin>
        <groupId>com.jayway.maven.plugins.android.generation2</groupId>
        <artifactId>android-maven-plugin</artifactId>
        <version>3.5.4-SNAPSHOT</version>
        ...
    </plugin>
    ...
    <pluginRepositories>
      <pluginRepository>
        <id>oss.sonatype.org-jayway-snapshots</id>
        <name>Jayway OpenSource SNAPSHOTs on Sonatype.org</name>
        <url>http://oss.sonatype.org/content/repositories/jayway-snapshots/</url>
        <snapshots>
          <enabled>true</enabled>
        </snapshots>
      </pluginRepository>
    </pluginRepositories>
    

    Please provide feedback on the developer group:

    New snapshot for 3.5.4 available

    0 讨论(0)
提交回复
热议问题