2014-01-09 57 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。

相关问题