我读了很多关于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>
<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在Eclipse也在导出其Android依赖项时试图导出其依赖项:
我正在尝试运行android-maven-plugin提供的官方HelloFlashlight示例,但Eclipse显示此错误。 生命周期配置未覆盖的插件执行:com.jayway.maven.plugins.android.generation2:android-maven-plugin:3.8.2:consumer-aar(执行:default-consumer-aar,阶段:compile)
主要内容:m2eclipse,在 Eclipse 中配置 Maven,修改本地仓库位置,在 Eclipse 中使用 Maven前面所涉及的 Maven 项目结构和代码都十分的简单,即使是使用最简单的文本编辑器也能够很快就能完成。但在实际的开发过程中,我们所涉及的 Maven 项目往往要复杂得多,此时我们就需要借助 IDE(集成开发环境) 来帮助我们完成开发工作。 当今最流行的 Java IDE 主要有 2 种:Eclipse 和 IntelliJ IDEA,其中 eclipse 是完全免费的,用
问题内容: 有谁知道使用maven和eclipse使用GWT的新2.0版本创建项目的好指南?我遇到了很多问题,无法让他们一起好好玩。 对于它的价值,我可以使用maven eclipse插件创建一个gwt项目,该插件可以正常工作,但是将其移植到maven则行不通(因此这方面的指南会很棒)。 同样,我可以使用Maven插件(gwt-maven- plugin),但是当我将其导入eclipse(导入->
问题内容: 摘要 当我尝试从Eclipse内(在Tomcat 7.0上)运行JSF 2.0应用程序时,出现以下异常: 细节 我正在学习使用Eclipse开发JSF应用程序。我从一个预先配置的Eclipse项目开始:File-> New-> Dynamic Web Project-> JavaServer Face v2.0 Project。使用此方法,Eclipse提供了所有依赖项。但我想真正地了
主要内容:执行预置 Maven 命令,执行自定义 Maven 命令在 Eclipse 中新建和导入 Maven 项目后,接下来就可以执行 Maven 命令对这些项目进行构建了。当然,您依然可以在命令行中执行 Maven 命令进行构建,不过本节将介绍如何在 Eclipse 中直接执行 Maven 命令。 执行预置 Maven 命令 在项目或其 pom.xml 上单击鼠标右键,选择 Run As 选项,就能够看到如图 1 的菜单。 图1:Eclipse 预置 Mav
主要内容:导入 Maven 项目我们知道,m2eclipse 是一个在 Eclipse 中集成 Maven 的插件,通过该插件我们可以很轻松的在 Eclipse 中导入 Maven 项目,本节我们将讲解如何使用 Eclipse 导入 Maven 项目。 导入 Maven 项目 相比新建 Maven 项目,实际工作中使用更多的是将现有的 Maven 项目导入 Eclipse,具体步骤如下。 1)点击菜单栏中的 Import ,开始