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

Dutch-Raptor25 picture Dutch-Raptor25 · Jul 2, 2015 · Viewed 11.3k times · Source

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'
}

Answer

Galileo picture Galileo · Dec 19, 2015

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.