2014-01-09 56 views
1

我與maven.here想要一個簡單的Android Hello World程序是我的pom.xml文件的Maven無法執行目標com.jayway.maven.plugins.android.generation2

<?xml version="1.0" encoding="UTF-8"?> 
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> 
    <modelVersion>4.0.0</modelVersion> 
    <groupId>appzoyfoo141</groupId> 
    <artifactId>ekanta</artifactId> 
    <version>1.0.0</version> 
    <packaging>apk</packaging> 
    <name>ekanta</name> 

    <properties> 
     <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> 
     <platform.version>4.1.1.4</platform.version> 
     <android.plugin.version>3.1.1</android.plugin.version> 
    </properties> 

    <dependencies> 
     <dependency> 
      <groupId>com.google.android</groupId> 
      <artifactId>android</artifactId> 
      <version>4.1.1.4</version> 
      <scope>provided</scope> 
     </dependency> 
    </dependencies> 
    <build> 
     <finalName>${project.artifactId}</finalName> 
     <pluginManagement> 
      <plugins> 
       <plugin> 
        <groupId>com.jayway.maven.plugins.android.generation2</groupId> 
        <artifactId>android-maven-plugin</artifactId> 
        <version>${android.plugin.version}</version> 
        <extensions>true</extensions> 
       </plugin> 
      </plugins> 
     </pluginManagement> 
     <plugins> 
      <plugin> 
       <groupId>com.jayway.maven.plugins.android.generation2</groupId> 
       <artifactId>android-maven-plugin</artifactId> 
       <configuration> 
        <sdk> 
         <platform>17</platform> 
         <path>${ANDROID_HOME}</path> 
        </sdk> 
       </configuration> 
      </plugin> 
     </plugins> 
    </build> 
</project> 

但試圖運行pom.xml中右擊pom.xml-> runas->行家test..getting此錯誤

Failed to execute goal com.jayway.maven.plugins.android.generation2`..Can anybody plz help me..thanks i am getting this error in console`[INFO] ------------------------------------------------------------------------ 
[INFO] BUILD FAILURE 
[INFO] ------------------------------------------------------------------------ 
[INFO] Total time: 0.613s 
[INFO] Finished at: Thu Jan 09 14:47:46 IST 2014 
[INFO] Final Memory: 6M/15M 
[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 ekanta: No Android SDK path could be found. You may configure it in the plugin configuration section in the pom file using <sdk><path>...</path></sdk> or <properties><android.sdk.path>...</android.sdk.path></properties> or on command-line using -Dandroid.sdk.path=... or by setting 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/MojoExecutionException` 
+0

我的猜測是maven並沒有替換你的pom中的$ {ANDROID_HOME}屬性,並且因此這不是有效的路徑,因此是異常。嘗試將'ANDROID_HOME'設置爲一個環境變量(因此在maven之外),然後完全刪除pom中插件的''配置,或者更改您的pom中的''配置,使其指向android sdk的位置明確。 – DB5

回答

-1

此路徑未設置:ANDROID_HOME和你的SDK可能是太低的版本。然後在setting.xml中設置完整路徑android sdk。

+0

什麼是'setting.xml'?請詳細說明。 –

1

當試圖構建Android Bootstrap項目時,我遇到了與com.jayway.maven插件相同的問題。
我能夠通過進入pom.xml屬性部分並添加我的ANDROID sdk路徑來解決此問題。

<properties> 
    <abs.version>4.3.1</abs.version> 
    <dagger.version>1.0.1</dagger.version> 
    <otto.version>1.3.4</otto.version> 
    <gson.version>2.2.4</gson.version> 
    <menudrawer.version>3.0.2</menudrawer.version> 
    <android.sdk.path>C:\Android\adt-bundle-windows-x86_64-20131030\sdk</android.sdk.path> 
</properties> 

我原來指向我的JAVA SDK導致它失敗 - 你需要將它指向你的ANDROID sdk。

相關問題