安卓的Maven找不到工具“AAPT”找不到、工具、Maven、AAPT

2023-09-13 02:26:10 作者:哇咔咔~\/~

我试图完成本教程:

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

但设置环境,并创建一个项目,在之后的运行方式\行家安装一步我得到这样的:

  SLF4J:无法加载类org.slf4j.impl.StaticLoggerBinder。
SLF4J:默认到无操作(NOP)记录器的实施
SLF4J:见http://www.slf4j.org/$c$cs.html#StaticLoggerBinder进一步的细节。
[信息]扫描项目...
[信息]
[信息]  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  - - -------------------------
[信息]大厦教程0.0.1-快照
[信息]  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  - - -------------------------
[信息]
[信息] --- Android的Maven的插件:3.1.1:产生-源(默认生成-源)@教程---
[信息] Android为9​​04-002:找到AIDL文件:计数= 0
[信息] Android为9​​04-002:找到AIDL文件:计数= 0
[信息]  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  - - -------------------------
[信息]构建失败
[信息]  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  - - -------------------------
[信息]总时间:1.889s
[信息]在表面处理:周六5月18日0时32分十二秒CEST 2013
[信息]最后的记忆:8M / 111M
[信息]  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  - - -------------------------
[错误]未能执行目标com.jayway.maven.plugins.android.generation2:Android的Maven的插件:3.1.1:产生-源(默认生成-源)项目教程:执行默认生成 - 源目标com.jayway.maven.plugins.android.generation2:Android的Maven的插件:3.1.1:产生-源失败:找不到工具AAPT。请提供一个适当的Andr​​oid SDK中的目录路径作为配置参数< SDK><路径> ...< /路径>< / SDK>在插件<结构/取代。作为替代方案,你可以添加参数到命令行:-Dandroid.sdk.path = ...或者设置环境变量ANDROID_HOME。 - > [说明1]
[错误]
[错误]要查看错误的完整的堆栈跟踪,重新运行Maven和-e开关。
[错误]使用-x开关来实现完整的调试日志记录重新运行Maven。
[错误]
[错误]有关错误和可能的解决方案,请阅读以下文章:
[错误] [说明1] http://cwiki.apache.org/confluence/display/MAVEN/PluginExecutionException
 

我试过很多次,但没有运气。 我已经在Windows7 64位,安装和Maven 3.0.5 Eclipse的朱诺APK工具。

这似乎对Maven的工作人员一个众所周知的问题:

https://$c$c.google.com/p/maven-android-plugin/issues/detail?id=104

但它应该从年龄来解决...

我的环境用户变量:

  M2_HOME = C:\ Program Files文件\的Java \ Apache的行家-3.0.5

ANDROID_HOME = C:\ ADT-束的Windows x86_64-20130514 \ SDK
 

我的环境系统变量:

Path=......;%ANDROID_HOME%\tools;%ANDROID_HOME%\platform-tools;%ANDROID_HOME%\build-tools;%ANDROID_HOME%\platforms;%M2_HOME%\bin;%ANDROID_HOME%\build-tools\android-4.2.2 部署Maven项目无法找到Maven管理的Jar包

有谁知道如何锻炼这个陷阱?

谢谢!

解决方案

我也遇到过使用最新的ADT时,谷歌和试图编译自举Android平台同样的问题。

最新的R17版本中分离出 AAPT 来建立-tools文件夹。因此,它是Maven的Andr​​oid的插件不支持它。

请参阅问题讨论here.

尝试和工作:

  CD $ ANDROID_HOME /平台工具
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
 

某些安装可能要使用的API版本的结构:

  CD $ ANDROID_HOME /平台工具
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
 

请记住,这是在最新的版本(> 3.5.3)Android的Maven插件,因为其他的答案指出。

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, and create a project, at the "run as\maven install" step i got this:

SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
[INFO] Scanning for projects...
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building tutorial 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- android-maven-plugin:3.1.1:generate-sources (default-generate-sources) @ tutorial ---
[INFO] ANDROID-904-002: Found aidl files: Count = 0
[INFO] ANDROID-904-002: Found aidl files: Count = 0
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.889s
[INFO] Finished at: Sat May 18 00:32:12 CEST 2013
[INFO] Final Memory: 8M/111M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.jayway.maven.plugins.android.generation2:android-maven-plugin:3.1.1:generate-sources (default-generate-sources) on project tutorial: Execution default-generate-sources of goal com.jayway.maven.plugins.android.generation2:android-maven-plugin:3.1.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 <configuration/>. As an alternative, you may add the parameter to commandline: -Dandroid.sdk.path=... or set environment variable ANDROID_HOME. -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginExecutionException

I've tried lot of times, but with no luck. I have Eclipse Juno on Windows7 64 bit, APK Tool installed and Maven 3.0.5.

It seems a well known problem for maven staff:

https://code.google.com/p/maven-android-plugin/issues/detail?id=104

but it should be solved from ages...

My Environment User variables:

M2_HOME=C:\Program Files\Java\apache-maven-3.0.5

ANDROID_HOME=C:\adt-bundle-windows-x86_64-20130514\sdk

My Environment System variable:

Path=......;%ANDROID_HOME%\tools;%ANDROID_HOME%\platform-tools;%ANDROID_HOME%\build-tools;%ANDROID_HOME%\platforms;%M2_HOME%\bin;%ANDROID_HOME%\build-tools\android-4.2.2

Does anybody know how to workout this trap?

thanks!

解决方案

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.