Gradle error: "Attribute "rippleColor" has already been defined" in android studio
Asked Answered
D

5

17

So I was trying out the material design support library and when I added the dependency, compiled, and I got this error. I looked at similar problems and tried their solutions but it would not get fixed so I hope you can help me.

Here's my logcat:

C:\Users\Jan\AndroidStudioProjects\SwagCalculator3\app\build\intermediates\exploded-aar\com.android.support\appcompat-v7\22.2.0\res\values\values.xml
Error:(1) Attribute "rippleColor" has already been defined

and here is my build.gradle:

apply plugin: 'com.android.application'

android {
compileSdkVersion 22
buildToolsVersion "22.0.1"

defaultConfig {
    applicationId "com.raptor.swagcalculator.swagcalculator"
    minSdkVersion 21
    targetSdkVersion 22

}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}
}

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:design:22.2.0'
compile 'com.android.support:appcompat-v7:22.2.0'
compile 'com.android.support:support-v4:22.2.0'
compile 'com.android.support:cardview-v7:22.2.0'
}
Donegal answered 2/7, 2015 at 11:21 Comment(0)
P
18

I have same issue , after long search I found there are some libraries use the same attribute rippleColor

Example:

1- Google play service

compile 'com.google.android.gms:play-services:7.8.0'

2- Design Support Library

compile 'com.android.support:design:22.2.0'

3- MaterialDesign

compile 'com.github.navasmdc:MaterialDesign:1.5@aar'

Fix this issue

First to fix this issue replace google play service package (whole package) with specific one you need , please review google site as in Google Wallet there attribute called rippleColor , in my case all I need google maps com.google.android.gms:play-services-maps:7.8.0

Second you can replace Design Support Library compile com.github.navasmdc:MaterialDesign:1.5@aar with compile 'it.neokree:MaterialNavigationDrawer:1.3.2' , if you need to use navigation drawer only

I hope this help

Photochronograph answered 8/9, 2015 at 11:31 Comment(5)
am also using all above libs except compile 'com.android.support:design:22.2.0' whein i add this in grladle showing rippleColor already defined but where can i find this.Afternoons
replace your imports with specific one , replace google play service library with what exactly you need , material navigation with it.neokree:MaterialNavigationDrawer:1.3.2Photochronograph
i need navigationdrawer with recyclerview and google maps and gplus sign in and rounded image for list of products and swipeto refresh for scrolldown display refresh icon goodle admob for testing addsAfternoons
Is it possible to overwrite RippleColor ?Corbel
I dont think so cause its attribute in library and you cant change itPhotochronograph
A
20

I found the solution here (https://github.com/navasmdc/MaterialDesignLibrary/issues/289 ). The MaterialDesign Library's rippleColor attritube is replaced with mRippleColor attribute and the compiled library is forked here (https://github.com/vajro/MaterialDesignLibrary).

Adding

repositories {
maven { url "https://jitpack.io" }

}

and replacing

compile 'com.github.navasmdc:MaterialDesign:1.5@aar'

with

compile 'com.github.vajro:MaterialDesignLibrary:1.6'

in your build.gradle file should solve the issue.

Ambages answered 19/12, 2015 at 22:50 Comment(1)
why min sdk increased from 10 to 16 in this new library?Exhilarative
P
18

I have same issue , after long search I found there are some libraries use the same attribute rippleColor

Example:

1- Google play service

compile 'com.google.android.gms:play-services:7.8.0'

2- Design Support Library

compile 'com.android.support:design:22.2.0'

3- MaterialDesign

compile 'com.github.navasmdc:MaterialDesign:1.5@aar'

Fix this issue

First to fix this issue replace google play service package (whole package) with specific one you need , please review google site as in Google Wallet there attribute called rippleColor , in my case all I need google maps com.google.android.gms:play-services-maps:7.8.0

Second you can replace Design Support Library compile com.github.navasmdc:MaterialDesign:1.5@aar with compile 'it.neokree:MaterialNavigationDrawer:1.3.2' , if you need to use navigation drawer only

I hope this help

Photochronograph answered 8/9, 2015 at 11:31 Comment(5)
am also using all above libs except compile 'com.android.support:design:22.2.0' whein i add this in grladle showing rippleColor already defined but where can i find this.Afternoons
replace your imports with specific one , replace google play service library with what exactly you need , material navigation with it.neokree:MaterialNavigationDrawer:1.3.2Photochronograph
i need navigationdrawer with recyclerview and google maps and gplus sign in and rounded image for list of products and swipeto refresh for scrolldown display refresh icon goodle admob for testing addsAfternoons
Is it possible to overwrite RippleColor ?Corbel
I dont think so cause its attribute in library and you cant change itPhotochronograph
H
4

It seems that in the projects you are using (your own application + the used libraries) the Attribute named rippleColor is used at least two times.

I'd suggest to check through your xml-s containing colors or any attributes (e.g colors.xml, or any other, try search for it in the whole project in your IDE).

Check whether the mentioned rippleColor is used multiple times. If you have it in your project, rename it!

Hollishollister answered 2/7, 2015 at 11:58 Comment(1)
I searched everywhere but found it only in the build directory, i dont think i should edit those files ? or should i ?Riotous
R
2

I also met this problem when using Material Design, this is because "rippleColor" conflicts with android support design package. If you downloaded the module and added it as a dependency, you can solved this problem as follows :

  1. Press shift-cmd-R to Replace in Path,
  2. Text to find : rippleColor
  3. Replace with : mrippleColor
  4. Check "Whole words only(may be faster)"
  5. press "find" button to replace

then click Build-Rebuild to rebuild the project, and it could build successfully.

enter image description here

Or you can just use this forked library: link, he did that replace job for you.

Royalroyalist answered 28/4, 2016 at 14:35 Comment(0)
S
2

I got the same issue because I'm using the MaterialDesign Library in my android application where the rippleColor attribute is defined. Here is the example which shows how I've solved this issue.

enter image description here

Schlimazel answered 18/4, 2017 at 7:12 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.