42

私はこのチュートリアルに従おうとしていました:

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

しかし、環境をセットアップしてプロジェクトを作成した後、「run as\maven install」ステップで次のようになりました。

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

何度も試しましたが、うまくいきませんでした。Windows7 64ビットにEclipse Juno、APKツールがインストールされ、Maven 3.0.5があります。

Maven スタッフにとってはよく知られた問題のようです。

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

しかし、それは古くから解決されるべきです...

私の環境 ユーザー変数:

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

ANDROID_HOME=C:\adt-bundle-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

このトラップのトレーニング方法を知っている人はいますか?

ありがとう!

4

6 に答える 6

96

また、Google の最新の ADT を使用してブートストラップ Android プラットフォームをコンパイルしようとすると、同じ問題が発生しました。

最新の r17 ビルドaaptは build-tools フォルダーに分離されます。したがって、maven-android-plugin はサポートできません。

ここで議論されている問題を参照してください。

試してみました:

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

一部のインストールは、API バージョンを使用して構成されている場合があります。

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

他の回答が指摘しているように、これは Android Maven Plugin の最新バージョン (> 3.5.3) で修正されていることに注意してください。

于 2013-05-18T01:36:35.257 に答える
21

アップデート:

これはAndroid Maven Plugin v3.6.0以降で解決されています。現時点では、IntelliJ v12.x を使用する場合にのみ、これらのシンボリック リンクが必要になります。IntelliJ v13 EAP+ はそのままで動作するはずです。

元の答え:

これは修正されており、Android Maven Plugin v3.5.4 でリリースされる予定です。github プル リクエストを参照してください。

sdklib のパスとプラットフォーム ユーティリティを使用するように AndroidSdk をアップグレードしました

以下を 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>

開発者グループに関するフィードバックをお寄せください:

3.5.4 の新しいスナップショットが利用可能

于 2013-05-22T13:57:37.993 に答える
0

私も同様の問題を抱えていました。

次の手順で解決:

1) maven を 3.1.1 にアップグレードします 2) android-maven-plugin 3.6.1 pr 以上を使用します [私は 3.8.0 を使用しました] 3) maven-dependency-plugin 2.8 を使用します

最新の Android SDK [ex : 4.3] に対してビルドする場合は、次の追加手順に従います - 4) コマンド mvn install:installFile を使用して android.jar のローカル コピーをインストールします。 5) 18 を設定します。

お役に立てれば。

于 2013-12-18T16:07:38.807 に答える
0

私は同じ問題で立ち往生しています。最後に、2時間後に問題を解決することができました. 簡単にして5分で問題を解決するために、以下の手順をリストしました

ステップ 1 - Eclipseで、ベータ リリース リンクを使用してAndroid Maven プラグインを 0.4.3.2013 に 更新します。http://rgladwell.github.io/m2e-android/updates/master/

ステップ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>

以下の問題を解決します

"No Android Platform Version/API Level has been configured"

Could not find tool 'aapt'

それが役に立てば幸い

于 2013-09-18T12:02:08.747 に答える