Maven, ActionBarSherlock v4 and Roboguice v2 - How

2019-07-20 03:33发布

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

1条回答
Root(大扎)
2楼-- · 2019-07-20 03:55

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>
查看更多
登录 后发表回答