2

I'm trying to build a project to uses both ActionBarSherlock v4 and Roboguice v2 (I like beeing of the bleeding edge :) ).

The problem is that ABS uses a slightly modified compatibility library, that Roboguice needs. I got it working fine under Eclipse by adding actionbarsherlock-plugin-compat-lib-4.0.0-SNAPSHOT, roboguice-2.0b3 and the ActionBarSherlock project.

Now the problem is that under Maven, I need to include the following dependency because of Roboguice:

<dependency>
   <groupId>android</groupId>
   <artifactId>compatibility-v4</artifactId>
   <version>r3-SNAPSHOT</version>
</dependency>

And I need to add the following dependency for ABS:

<dependency>
   <groupId>com.actionbarsherlock</groupId>
   <artifactId>plugin-compat-lib</artifactId>
   <version>4.0.0-SNAPSHOT</version>
</dependency>

When I do a "mvn clean install", the following error occurs:

[INFO] java.lang.IllegalArgumentException: already added: Landroid/
support/v4/app/ActivityCompatHoneycomb;

because ActivityCompatHoneycomb is present in both dependency.

Any suggestions?

The full source code and build project is available at: https://github.com/thierryd/adg-android

Thierry Roy
  • 8,452
  • 10
  • 60
  • 84
  • 2
    Perhaps dependency management will help you: either for `compatibility-v4` or for `plugin-compat-lib` you need to add `` section. Look around how to do it. – dma_k Jan 23 '12 at 18:17

1 Answers1

2

Thanks to @dma_k, it worked by adding the following "exclusion" tag and by removing the "compatibility-v4" dependency:

<dependency>
    <groupId>org.roboguice</groupId>
    <artifactId>roboguice</artifactId>
    <version>2.0-SNAPSHOT</version>
    <scope>compile</scope>
    <exclusions>
        <exclusion>
            <groupId>android.support</groupId>
            <artifactId>compatibility-v4</artifactId>
        </exclusion>
    </exclusions>
</dependency>
Thierry Roy
  • 8,452
  • 10
  • 60
  • 84
  • for correctness of the pom you might want to leave the dep for the compatibility library in but set it to be provided.. that should work too. – Manfred Moser Jan 26 '12 at 20:08
  • @ManfredMoser I tried setting it to provided and it didn't work. Can you submit a correct pom so that I could try it? – Thierry Roy Jan 26 '12 at 20:27