Dependencies to use appcompat ActionBar...

226 views
Skip to first unread message

Roberto Simoni

unread,
Feb 17, 2015, 6:19:02 PM2/17/15
to maven-androi...@googlegroups.com
Hi, I'm trying to use appcompat ActionBar and to do that I have added follow dependencies:

   [...]
        <android.platform.version.semantic>4.4.2_r4</android.platform.version.semantic>
        <android.support.version>21.0.3</android.support.version>
   [...]
        <dependency>
            <groupId>com.android.support</groupId>
            <artifactId>appcompat-v7</artifactId>
            <version>${android.support.version}</version>
            <type>aar</type>
        </dependency>
        <dependency>
            <groupId>android.support</groupId>
            <artifactId>compatibility-v7-appcompat</artifactId>
            <version>${android.support.version}</version>
            <type>apklib</type>
        </dependency>
        <dependency>
            <groupId>android.support</groupId>
            <artifactId>compatibility-v7-appcompat</artifactId>
            <version>${android.support.version}</version>
            <type>jar</type>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>android</groupId>
            <artifactId>android</artifactId>
            <version>${android.platform.version.semantic}</version>
            <scope>provided</scope>
        </dependency>
    [...]

when I try to compile I receive this error:

[INFO] Extracting apklib compatibility-v7-appcompat...
[WARNING] 
[WARNING] Duplicate packages detected in AndroidManifest.xml files
[WARNING] 
[WARNING] Such scenario generally means that the build will fail with a compilation error due to missing resources in R file.
[WARNING] You should consider renaming some of the duplicate packages listed below to avoid the conflict.
[WARNING] 
[WARNING] Conflicting artifacts:
[WARNING]     [compatibility-v7-appcompat, appcompat-v7] have similar package='android.support.v7.appcompat'
[WARNING] 
[INFO] Generating R file for com.github.sixro.duffel:duffel-main-android:apk:1.0.0-SNAPSHOT
[INFO] /home/rsimoni/Development/projects/sixro/duffel/main-android/target/unpacked-libs/cas_appcompat-v7_21.0.3/res/values/values.xml:4: error: Attribute "drawerArrowStyle" has already been defined
[INFO] 
[INFO] /home/rsimoni/Development/projects/sixro/duffel/main-android/target/unpacked-libs/cas_appcompat-v7_21.0.3/res/values/values.xml:5: error: Attribute "height" has already been defined
[INFO] 
[INFO] /home/rsimoni/Development/projects/sixro/duffel/main-android/target/unpacked-libs/cas_appcompat-v7_21.0.3/res/values/values.xml:6: error: Attribute "isLightTheme" has already been defined

Would you mind helping me on how to setup correctly these dependencies in order to use appcompat support ActionBar?
Thanks Bye
  R

Richard Mortimer

unread,
Feb 18, 2015, 4:31:28 AM2/18/15
to maven-androi...@googlegroups.com
Hi,

On 17/02/2015 23:19, Roberto Simoni wrote:
> Hi, I'm trying to use appcompat ActionBar and to do that I have added
> follow dependencies:
>

You seem to be using a mix of aar and apklib/jar dependencies. The
former replaces the latter.

From memory there is also a bug in the appcompat-v7 pom that places a
dependency on the jar version of support-v4 rather than aar. To work
around that you have to exclude that from the v7 aar dependency and add
it explicitly.

Relevant changes are listed below.

> [...]
>
> <android.platform.version.semantic>4.4.2_r4</android.platform.version.semantic>
> <android.support.version>21.0.3</android.support.version>
> [...]
> <dependency>
> <groupId>com.android.support</groupId>
> <artifactId>appcompat-v7</artifactId>
> <version>${android.support.version}</version>
> <type>aar</type>

<exclusions>
<exclusion>
<groupId>com.android.support</groupId>
<artifactId>support-v4</artifactId>
</exclusion>
</exclusions>

> </dependency>

<dependency>
<groupId>com.android.support</groupId>
<artifactId>support-v4</artifactId>
<scope>compile</scope>
<type>aar</type>
</dependency>


Then remove the following 2 dependencies on compatibility-v7-appcompat.
> <dependency>
> <groupId>android.support</groupId>
> <artifactId>compatibility-v7-appcompat</artifactId>
> <version>${android.support.version}</version>
> <type>apklib</type>
> </dependency>
> <dependency>
> <groupId>android.support</groupId>
> <artifactId>compatibility-v7-appcompat</artifactId>
> <version>${android.support.version}</version>
> <type>jar</type>
> <scope>provided</scope>
> </dependency>
>

Hope that helps.

Richard
> --
> You received this message because you are subscribed to the Google
> Groups "Maven Android Developers" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to maven-android-deve...@googlegroups.com
> <mailto:maven-android-deve...@googlegroups.com>.
> For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages