我读了很多关于 actionbarsherlock、maven、android 的东西,但我见过的解决方案都没有为我工作:(
我确定我非常接近解决方案,但我不明白,我需要一些帮助:)
所以这是我的问题,我尝试创建一个依赖于 Actionbarsherlock 的 android maven 项目......看起来很简单,但我总是有这些错误
[2013-01-16 18:10:28 - Dex Loader] Unable to execute dex: Multiple dex files define Landroid/support/v4/accessibilityservice/AccessibilityServiceInfoCompat$AccessibilityServiceInfoVersionImpl;
[2013-01-16 18:10:28 - greennfc-samples] Conversion to Dalvik format failed: Unable to execute dex: Multiple dex files define Landroid/support/v4/accessibilityservice/AccessibilityServiceInfoCompat$AccessibilityServiceInfoVersionImpl;
[2013-01-16 18:10:50 - Dex Loader] Unable to execute dex: Multiple dex files define Lorg/hamcrest/Description;
[2013-01-16 18:10:50 - greennfc-samples] Conversion to Dalvik format failed: Unable to execute dex: Multiple dex files define Lorg/hamcrest/Description;
这是我的配置:
Eclipse Juno M2e 1.2.0 ADT 21 Maven 3.0.4
这是父 pom :
<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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.sonatype.oss</groupId>
<artifactId>oss-parent</artifactId>
<version>7</version>
</parent>
<groupId>com.greennfc.tools</groupId>
<artifactId>greennfc</artifactId>
<version>1.0.0-SNAPSHOT</version>
<name>Green NFC - Parent</name>
<description>Android Nfc library for an easer management of NFC features</description>
<packaging>pom</packaging>
<url>https://github.com/binomed/greennfc</url>
<inceptionYear>2013</inceptionYear>
<!--
<scm>
<connection>scm:git:ssh://git@github.com/octo-online/robospice.git</connection>
<url>git:ssh://git@github.com/octo-online/robospice.git</url>
<developerConnection>scm:git:ssh://git@github.com/octo-online/robospice.git</developerConnection>
<tag>HEAD</tag>
</scm>
-->
<licenses>
<license>
<name>Apache 2</name>
<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
</license>
</licenses>
<issueManagement>
<system>Github Issue Tracker</system>
<url>https://github.com/octo-online/robospice/issues</url>
</issueManagement>
<developers>
<developer>
<id>JFG</id>
<name>Jean-Francois Garreau</name>
<email>jean.francois.garreau@binomed.fr</email>
</developer>
</developers>
<!--
<mailingLists>
<mailingList>
<name>RoboSpice Forum/Mailinglist</name>
<post>http://groups.google.com/group/robospice</post>
<subscribe>http://groups.google.com/group/robospice/subscribe</subscribe>
<unsubscribe>https://groups.google.com/group/robospice/subscribe</unsubscribe>
</mailingList>
</mailingLists>
<ciManagement>
<system>jenkins</system>
<url>https://robospice.ci.cloudbees.com/job/Build%20RoboSpice/</url>
</ciManagement>
-->
<modules>
<!-- core library -->
<module>greennfc-core</module>
<!-- Base librairies elements -->
<module>greennfc-filters</module>
<!-- extensions -->
<!-- Demo -->
<module>greennfc-samples</module>
</modules>
<properties>
<android.version>4.1.1.4</android.version>
<android-platform.version>14</android-platform.version>
<android-annotations.version>4.1.1.4</android-annotations.version>
<android-support.version>r7</android-support.version>
<android-maven-plugin.version>3.5.0</android-maven-plugin.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<github.global.server>github</github.global.server>
<maven.javadoc.skip>true</maven.javadoc.skip>
</properties>
<!-- TODO : remove this when android maven plugin 3.4.2 is out -->
<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>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>com.google.android</groupId>
<artifactId>annotations</artifactId>
<version>${android-annotations.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.google.android</groupId>
<artifactId>android</artifactId>
<version>${android.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.google.android</groupId>
<artifactId>android-test</artifactId>
<version>${android.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>provided</scope>
</dependency>
<!-- https://stackoverflow.com/questions/5591811/ignoring-innerclasses-attribute-warning-is-killing-eclipse -->
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<version>1.1.1</version>
</dependency>
</dependencies>
</dependencyManagement>
<build>
<pluginManagement>
<plugins>
<!-- https://stackoverflow.com/questions/13040788/how-to-elimate-the-maven-enforcer-plugin-goal-enforce-is-ignored-by-m2e-wa -->
<plugin>
<groupId>org.eclipse.m2e</groupId>
<artifactId>lifecycle-mapping</artifactId>
<version>1.0.0</version>
<configuration>
<lifecycleMappingMetadata>
<pluginExecutions>
<pluginExecution>
<pluginExecutionFilter>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<versionRange>[1.0.0,)</versionRange>
<goals>
<goal>enforce</goal>
</goals>
</pluginExecutionFilter>
<action>
<ignore />
</action>
</pluginExecution>
<pluginExecution>
<pluginExecutionFilter>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<versionRange>[1.0.0,)</versionRange>
<goals>
<goal>copy-dependencies</goal>
</goals>
</pluginExecutionFilter>
<action>
<ignore />
</action>
</pluginExecution>
</pluginExecutions>
</lifecycleMappingMetadata>
</configuration>
</plugin>
<plugin>
<groupId>com.jayway.maven.plugins.android.generation2</groupId>
<artifactId>android-maven-plugin</artifactId>
<version>${android-maven-plugin.version}</version>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
</plugin>
<plugin>
<artifactId>maven-deploy-plugin</artifactId>
<version>2.7</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.7</version>
<configuration>
<links>
<link>http://commons.apache.org/lang/api</link>
<link>http://java.sun.com/j2se/1.5.0/docs/api</link>
</links>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>2.1.2</version>
</plugin>
<!-- deploy artifacts to github for downloads -->
<plugin>
<groupId>com.github.github</groupId>
<artifactId>downloads-maven-plugin</artifactId>
<version>0.6</version>
<configuration>
<description>${project.version} release of ${project.name}</description>
<override>true</override>
<includeAttached>true</includeAttached>
<includes>
<include>${project.artifactId}-${project.version}.jar</include>
</includes>
</configuration>
<executions>
<execution>
<goals>
<goal>upload</goal>
</goals>
<phase>deploy</phase>
</execution>
</executions>
</plugin>
<!-- deploy javadoc and maven site to github -->
<plugin>
<groupId>com.github.github</groupId>
<artifactId>site-maven-plugin</artifactId>
<version>0.7</version>
<configuration>
<message>Creating site for ${project.version}</message>
</configuration>
<executions>
<execution>
<goals>
<goal>site</goal>
</goals>
<phase>site</phase>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-site-plugin</artifactId>
<version>3.0</version>
<configuration>
<reportPlugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-project-info-reports-plugin</artifactId>
<version>2.2</version>
<configuration>
<dependencyDetailsEnabled>true</dependencyDetailsEnabled>
<dependencyLocationsEnabled>true</dependencyLocationsEnabled>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.7</version>
</plugin>
</reportPlugins>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<version>1.1</version>
<executions>
<execution>
<id>sign-artifacts</id>
<phase>verify</phase>
<goals>
<goal>sign</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<autoVersionSubmodules>true</autoVersionSubmodules>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
<profiles>
<profile>
<id>sign</id>
<activation>
<property>
<name>performRelease</name>
<value>true</value>
</property>
</activation>
<properties>
<maven.javadoc.skip>false</maven.javadoc.skip>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
</plugin>
</plugins>
</build>
</profile>
</profiles>
这是我项目的 pom
<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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.greennfc.tools</groupId>
<artifactId>greennfc</artifactId>
<version>1.0.0-SNAPSHOT</version>
</parent>
<artifactId>greennfc-samples</artifactId>
<packaging>apk</packaging>
<name>Green Nfc - Samples</name>
<properties>
<notificationcompat2.version>1.1.2</notificationcompat2.version>
<actionbarsherlock.version>4.2.0</actionbarsherlock.version>
<roboguice.version>2.0</roboguice.version>
<robosherlock.version>1.4</robosherlock.version>
<google.http.client.version>1.12.0-beta</google.http.client.version>
<simplexmlserializer.version>2.6.6</simplexmlserializer.version>
<jackson.version>1.9.9</jackson.version>
</properties>
<dependencies>
<!-- Green Nfc dependencies -->
<dependency>
<groupId>com.greennfc.tools</groupId>
<artifactId>greennfc-core</artifactId>
<version>${project.version}</version>
</dependency>
<!-- Other libs -->
<dependency>
<groupId>com.google.android</groupId>
<artifactId>android</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.google.android</groupId>
<artifactId>support-v4</artifactId>
<version>${android-support.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.actionbarsherlock</groupId>
<artifactId>actionbarsherlock</artifactId>
<version>${actionbarsherlock.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.actionbarsherlock</groupId>
<artifactId>actionbarsherlock</artifactId>
<version>${actionbarsherlock.version}</version>
<type>apklib</type>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<sourceDirectory>src/</sourceDirectory>
<plugins>
<plugin>
<groupId>com.jayway.maven.plugins.android.generation2</groupId>
<artifactId>android-maven-plugin</artifactId>
<configuration>
<androidManifestFile>${project.basedir}/AndroidManifest.xml</androidManifestFile>
<assetsDirectory>${project.basedir}/assets</assetsDirectory>
<resourceDirectory>${project.basedir}/res</resourceDirectory>
<nativeLibrariesDirectory>${project.basedir}/src/main/native</nativeLibrariesDirectory>
<sdk>
<platform>${android-platform.version}</platform>
</sdk>
<undeployBeforeDeploy>true</undeployBeforeDeploy>
</configuration>
<extensions>true</extensions>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
</plugins>
</build>
我在这里尝试:
带有测试套件的 Maven Android 项目 http://v.zasadnyy.com/blog/abs-maven-eclipse-integration/
作为actionbarsherlock项目,我使用的是git仓库的head,我复制了库目录,粘贴到和我的父项目相同的文件夹中,并根据{groupId}-{artifactId}-{version}重命名
我真的很愿意从头开始重新开始并找到一种正确的方法,因为我不明白为什么它不起作用...... :(
在此先感谢您的帮助