Android: Attribute "rippleColor" already defined

My Android application had no problems with this build.gradle file.

apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.1"

    defaultConfig {
        applicationId "com.marshall.opensurvey"
        minSdkVersion 15
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

repositories {
    jcenter()
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:23.1.0'
    compile 'com.android.support:design:23.1.0'
    compile 'com.android.support:support-annotations:23.1.0'
    compile 'com.android.support:support-v4:23.1.0'
    compile 'com.android.support:support-v13:23.1.0'
    compile 'com.squareup.okhttp:okhttp:2.0.0'

    // Material Drawer Library by Mike Penz
    compile('com.mikepenz:materialdrawer:4.3.9@aar') {
        transitive = true
    }
    // Android Iconics Library by Mike Penz
    compile 'com.mikepenz:iconics-core:1.7.9@aar'
    compile 'com.mikepenz:google-material-typeface:1.2.0.1@aar'
    // Google Analytics Library
    compile 'com.google.android.gms:play-services-analytics:8.1.0'
    // Circle Image View Library
    compile 'de.hdodenhof:circleimageview:2.0.0'
    // Flat Button Library
    compile 'info.hoang8f:fbutton:1.0.5'
    // Process Button Library
    compile 'com.github.dmytrodanylyk.android-process-button:library:1.0.4'
    // Fancy Button Library
    compile 'com.github.medyo:fancybuttons:1.5@aar'

    // Card View and Recycler View Library
    compile 'com.android.support:cardview-v7:23.1.0'
    compile 'com.android.support:recyclerview-v7:23.1.0'
}

But, when I added another dependency in the build.gradle file and synchronized it, it started showing an error, stating that the attribute "rippleColor" was already defined. The new dependency that I put in the gradle file is this.

// Material Design Library
compile 'com.github.navasmdc:MaterialDesign:1.5@aar'

I assume this error is shown because the newly added contains an attribute that has the same name as that already defined in the previously added libraries. What should I change in this file so that third-party libraries do not crash each other?

+4
source share
4 answers

, MaterialDesign .

attrs.xml, rippleColor . , , .

,

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <declare-styleable name="CustomAttributes">
        <!-- Color of ripple animation -->
        <attr name="mdl_rippleColor" format="color|reference" />
        <!-- You can also prefix all other attributes -->
    </declare-styleable>
</resources>

MaterialDesign , . LayoutRipple (Line: 56).

, . 200 30 .


, ( v23.1.0) SNAPSHOT maven. , :

maven SNAPSHOT build.gradle

maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }

: maven sNAPSHOT

build.gradle

compile 'com.mikepenz.thirdparty:material-design-library:1.5.0-SNAPSHOT'

SNAPSHOT *.aar. maven , maven.

+2

. ,

<attr name="rippleColor" format="color" />

attrs.xml . "rippleColor", . gradle:

 compile 'com.github.navasmdc:MaterialDesign:1.5@aar'
compile 'com.nineoldandroids:library:2.4+'

.

+1

, , . niwinnm com.android.support:design, com.github.navasmdc: MaterialDesign: 1.5@aar 'com.github.vajro: MaterialDesignLibrary: 1.6'

+1

build.gradle

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

, .

0
source

Source: https://habr.com/ru/post/1614158/


All Articles