I read lots of things about actionbarsherlock, maven, android but none of the solution I\'ve seen worked for me :(
I\'m sure that I\'m pretty close to the solution but I
I had a very similar issue using Maven, Eclipse, and ActionBarSherlock. The problem is that the support library gets put into the build path twice, making the dexopt confused about the multiple declarations.
I was able to get rid of one of the places where dexopt was finding the support library by changing the pom.xml
for ActionBarSherlock from
<dependency>
<groupId>com.google.android</groupId>
<artifactId>support-v4</artifactId>
</dependency>
to
<dependency>
<groupId>com.google.android</groupId>
<artifactId>support-v4</artifactId>
<scope>provided</scope>
</dependency>
Make sure you clean the project after saving this change.
I tried hard to make the ActionBarSherlock lib project work with Maven but I failed. Similar issues. So I removed maven dependencies in the lib project and use libs/android-support-v4.jar instead. Btw, the test folder is also deleted. Then I run my own project with refers to the lib project. Things went well.
Here's how I fixed it. It's due to Maven trying to export its dependencies when Eclipse is also exporting its Android dependencies:
Ok thanks every one for your answers, the things that worked for me was :
You need to identify which dependencies in your pom.xml are including the classes that the Dalvik compiler is complaining about.
In eclipse, you can identify what jar the problematic class belongs to by Open Type (on mac Command-T).
Then you determine which transitive dependencies to those jars you have by looking up each direct dependency you have in maven central. And peering into the projects pom.xml.
Once identified you need to add exclusion clauses to the corresponding dependency configuration in your project pom.xml.
project pom.xml:
<dependencies>
<dependency>
<groupId>...</groupId>
<artifactId>...</artifactId>
<exclusions>
<exclusion>
<artifactId>org.hamcrest</artifactId>
<groupId>hamcrest</groupId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
There's a brute force way to do it as well. Just open up the project in eclipse, expand the 'Maven Dependencies' in project viewer, then add the exclusion clause to each direct dependency in your project pom one by one, each time hitting save. The android maven configuration plugin will recalculate the dependencies under 'Maven Dependencies' and you'll see the problematic jar disappear. Once you get all of them your Dalvik errors will disappear as well.