我嘗試了每個廣告方法,在嘗試使用android-maven-plugin構建Android應用程序時指定我的Android SDK的路徑,但沒有任何效果。無論我做什麼,當我運行無法獲取android-maven-plugin來識別SDK路徑
mvn clean install
我得到
... 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.
我設置環境變量ANDROID_HOME指向SDK的根目錄下,並出口了。然後
<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>
不起作用。 (我有安裝在SDK API 19)
<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>
不起作用
<properties>
<android.sdk.path>/absolute/path/to/sdk</android.sdk.path>
</properties>
不工作。並且
mvn clean install -Dandroid.sdk.path=/absolute/path/to/sdk
不起作用。
我也嘗試將SDK中的工具,平臺工具和構建工具/ 19.1.1目錄附加到$ PATH,並且這也不起作用。我的路徑上提供了aapt工具,但maven插件拒絕看到它。我搜索了網頁,我看到的唯一建議就是做我所做的。
我錯過了什麼?我在OSX系統上這樣做。
看起來像你的'ANDROID_HOME'?什麼android-maven-plugin版本? – MariuszS
我認爲插件版本是問題。我使用3.1.1,從一個例子中我抓住了網絡。我試過3.8.2,最新的,我必須從maven2升級到maven3。現在會這樣做並報告回來,但這可能是問題所在。 – MidnightJava
是的,當然,較舊的android-maven-plugins與新的android SDK不兼容。 – MariuszS