Android Maven BUILD FAILED

时间:2011-11-28 06:27:18

标签: java android maven

几天前,我决定在IntellijIDEA下使用Maven组装Android APK。我已找到所有库,连接它,现在我pom.xml看起来像这样:

<?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>com.example</groupId>
<artifactId>helloflashlight</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>apk</packaging>
<name>HelloFlashlight</name>

<dependencies>

    <dependency>
        <groupId>android</groupId>
        <artifactId>android</artifactId>
        <version>2.2_r3</version>
        <scope>provided</scope>
    </dependency>

    <dependency>
        <groupId>com.google.android.maps</groupId>
        <artifactId>maps</artifactId>
        <version>8_r2</version>
        <scope>provided</scope>
    </dependency>

    <dependency>
        <groupId>com.google.http-client</groupId>
        <artifactId>google-http-client</artifactId>
        <version>1.6.0-beta</version>
    </dependency>

    <dependency>
        <groupId>com.google.http-client</groupId>
        <artifactId>google-http-client-extensions-android2</artifactId>
        <version>1.6.0-beta</version>
    </dependency>

    <dependency>
        <groupId>com.google.guava</groupId>
        <artifactId>guava</artifactId>
        <version>10.0.1</version>
    </dependency>

    <dependency>
        <groupId>joda-time</groupId>
        <artifactId>joda-time</artifactId>
        <version>2.0</version>
    </dependency>

    <dependency>
        <groupId>com.bugsense.trace</groupId>
        <artifactId>bugsense-trace</artifactId>
        <version>1.1.2</version>
        <scope>system</scope>
        <systemPath>${project.basedir}/libs/bugsense-trace-1-1-2.jar</systemPath>
    </dependency>

</dependencies>

<build>

    <finalName>${project.artifactId}</finalName>
    <sourceDirectory>src</sourceDirectory>

    <pluginManagement>
        <plugins>
            <plugin>
                <groupId>com.jayway.maven.plugins.android.generation2</groupId>
                <artifactId>android-maven-plugin</artifactId>
                <version>3.0.0</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 or api level (api level 4 = platform 1.6)-->
                    <platform>8</platform>
                </sdk>
            </configuration>
        </plugin>
    </plugins>
</build>

但是当我试图运行mvn3 install时,我收到错误:

[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 18.123s
[INFO] Finished at: Mon Nov 28 11:24:55 YEKT 2011
[INFO] Final Memory: 22M/255M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.jayway.maven.plugins.android.generation2:android-maven-plugin:3.0.0:dex (default-dex) on project helloflashlight: MojoExecutionException: ANDROID-040-001: Could not execute: Command = /bin/sh -c cd /home/dmitry/projects/flash/android && /usr/lib/jvm/jdk1.7.0/jre/bin/java -jar /home/dmitry/android-sdk/platform-tools/lib/dx.jar --dex --output=/home/dmitry/projects/flash/android/target/classes.dex /home/dmitry/.m2/repository/commons-logging/commons-logging/1.1.1/commons-logging-1.1.1.jar /home/dmitry/.m2/repository/org/khronos/opengl-api/gl1.1-android-2.1_r1/opengl-api-gl1.1-android-2.1_r1.jar /home/dmitry/.m2/repository/joda-time/joda-time/2.0/joda-time-2.0.jar /home/dmitry/.m2/repository/xerces/xmlParserAPIs/2.6.2/xmlParserAPIs-2.6.2.jar /home/dmitry/.m2/repository/junit/junit/4.8.2/junit-4.8.2.jar /home/dmitry/.m2/repository/org/codehaus/jackson/jackson-core-asl/1.9.1/jackson-core-asl-1.9.1.jar /home/dmitry/.m2/repository/com/google/android/android/2.1.2/android-2.1.2.jar /home/dmitry/.m2/repository/com/google/code/findbugs/jsr305/1.3.9/jsr305-1.3.9.jar /home/dmitry/projects/taxi/android/target/classes /home/dmitry/.m2/repository/com/google/guava/guava/10.0.1/guava-10.0.1.jar /home/dmitry/.m2/repository/org/apache/httpcomponents/httpclient/4.0.3/httpclient-4.0.3.jar /home/dmitry/.m2/repository/org/apache/httpcomponents/httpcore/4.0.1/httpcore-4.0.1.jar /home/dmitry/.m2/repository/com/google/protobuf/protobuf-java/2.2.0/protobuf-java-2.2.0.jar /home/dmitry/.m2/repository/com/google/code/gson/gson/1.7.1/gson-1.7.1.jar /home/dmitry/.m2/repository/commons-codec/commons-codec/1.3/commons-codec-1.3.jar /home/dmitry/.m2/repository/org/json/json/20080701/json-20080701.jar /home/dmitry/.m2/repository/com/google/http-client/google-http-client-extensions-android2/1.6.0-beta/google-http-client-extensions-android2-1.6.0-beta.jar /home/dmitry/.m2/repository/com/google/http-client/google-http-client/1.6.0-beta/google-http-client-1.6.0-beta.jar /home/dmitry/.m2/repository/xpp3/xpp3/1.1.4c/xpp3-1.1.4c.jar, Result = 1 -> [Help 1]

有人面对吗?

编辑:在“测试”部分之后打印所有消息

2 个答案:

答案 0 :(得分:2)

您是否尝试过在shell中执行错误命令? 这应该会给你更多关于在哪里和什么附加的细节... 这是报告的命令,其安装报告中包含返回代码1(错误):

$ /bin/sh -c cd /home/dmitry/projects/flash/android && /usr/lib/jvm/jdk1.7.0/jre/bin/java -jar \
  /home/dmitry/android-sdk/platform-tools/lib/dx.jar --dex --output=/home/dmitry/projects/flash/android/target/classes.dex \
  /home/dmitry/.m2/repository/commons-logging/commons-logging/1.1.1/commons-logging-1.1.1.jar 
  /home/dmitry/.m2/repository/org/khronos/opengl-api/gl1.1-android-2.1_r1/opengl-api-gl1.1-android-2.1_r1.jar 
  /home/dmitry/.m2/repository/joda-time/joda-time/2.0/joda-time-2.0.jar \
  /home/dmitry/.m2/repository/xerces/xmlParserAPIs/2.6.2/xmlParserAPIs-2.6.2.jar \
  /home/dmitry/.m2/repository/junit/junit/4.8.2/junit-4.8.2.jar \
  /home/dmitry/.m2/repository/org/codehaus/jackson/jackson-core-asl/1.9.1/jackson-core-asl-1.9.1.jar \
  /home/dmitry/.m2/repository/com/google/android/android/2.1.2/android-2.1.2.jar \
  /home/dmitry/.m2/repository/com/google/code/findbugs/jsr305/1.3.9/jsr305-1.3.9.jar \
  /home/dmitry/projects/taxi/android/target/classes \
  /home/dmitry/.m2/repository/com/google/guava/guava/10.0.1/guava-10.0.1.jar \
  /home/dmitry/.m2/repository/org/apache/httpcomponents/httpclient/4.0.3/httpclient-4.0.3.jar \
  /home/dmitry/.m2/repository/org/apache/httpcomponents/httpcore/4.0.1/httpcore-4.0.1.jar \
  /home/dmitry/.m2/repository/com/google/protobuf/protobuf-java/2.2.0/protobuf-java-2.2.0.jar \
  /home/dmitry/.m2/repository/com/google/code/gson/gson/1.7.1/gson-1.7.1.jar \
  /home/dmitry/.m2/repository/commons-codec/commons-codec/1.3/commons-codec-1.3.jar \
  /home/dmitry/.m2/repository/org/json/json/20080701/json-20080701.jar \
  /home/dmitry/.m2/repository/com/google/http-client/google-http-client-extensions-android2/1.6.0-beta/google-http-client-extensions-android2-1.6.0-beta.jar \
  /home/dmitry/.m2/repository/com/google/http-client/google-http-client/1.6.0-beta/google-http-client-1.6.0-beta.jar \
  /home/dmitry/.m2/repository/xpp3/xpp3/1.1.4c/xpp3-1.1.4c.jar

答案 1 :(得分:0)

你是在unix下开发的吗?

我遇到了同样的错误,因为我将Android SDK二进制文件从windows复制到linux,但忘记安装linux特定的二进制文件(在http://developer.android.com/sdk/index.html提供)