简体   繁体   中英

My Android app is getting synced successfully but when running the app then giving error Execution failed for task ':app:mergeDebugResources'

app\\build.gradle file

apply plugin: 'com.android.application'

android {

    compileSdkVersion 28
    defaultConfig {
        minSdkVersion 16
        targetSdkVersion 28
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        signingConfig signingConfigs.config
        vectorDrawables.useSupportLibrary = true
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            signingConfig signingConfigs.config
        }
        debug {
            signingConfig signingConfigs.config
        }
    }
    productFlavors {
    }
}

repositories {
    mavenCentral()
}

dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    implementation 'com.android.support:appcompat-v7:28.0.0'
    implementation 'com.android.support:design:28.0.0'
    implementation 'com.android.support:support-v4:28.0.0'
    implementation 'com.android.support:cardview-v7:28.0.0'
    implementation 'com.google.android.gms:play-services-auth:16.0.1'
    implementation 'com.google.firebase:firebase-auth:16.2.0'
    implementation 'com.google.firebase:firebase-database:16.1.0'
    implementation 'com.google.firebase:firebase-crash:16.2.1'
//    implementation 'com.facebook.android:facebook-android-sdk:4.29.0'
    implementation 'com.github.paolorotolo:appintro:4.1.0'
    implementation 'com.jakewharton:butterknife:8.4.0'
    implementation 'uk.co.samuelwall:material-tap-target-prompt:1.8.3'
    implementation 'com.google.code.gson:gson:2.8.2'
    implementation 'com.android.support:support-vector-drawable:28.0.0'
    testImplementation 'junit:junit:4.12'
    annotationProcessor 'com.jakewharton:butterknife-compiler:8.4.0'
//    debugImplementation 'com.facebook.stetho:stetho:1.0.0'
}

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

Error Log when application is executed.

FAILURE: Build failed with an exception.

What went wrong:

Execution failed for task ':app:mergeDebugResources'. java.util.concurrent.ExecutionException: com.android.builder.internal.aapt.v2.Aapt2Exception: Android resource compilation failed

C:\\Users\\128953.gradle\\caches\\transforms-1\\files-1.1\\design-28.0.0.aar\\bcaf2691803e4aceded82ce44741aa87\\res\\values\\values.xml:168:5-120: AAPT: error: duplicate value for resource 'attr/iconTint' with config ''. C:\\Users\\128953.gradle\\caches\\transforms-1\\files-1.1\\design-28.0.0.aar\\bcaf2691803e4aceded82ce44741aa87\\res\\values\\values.xml:168:5-120: AAPT: error: resource previously defined here. C:\\Users\\128953.gradle\\caches\\transforms-1\\files-1.1\\appcompat-v7-28.0.0.aar\\e266a3de4bfa13bf456f367854478beb\\res\\values\\values.xml:987:5-1006:25: AAPT: error: duplicate value for resource 'attr/iconTint' with config ''. C:\\Users\\128953.gradle\\caches\\transforms-1\\files-1.1\\appcompat-v7-28.0.0.aar\\e266a3de4bfa13bf456f367854478beb\\res\\values\\values.xml:987:5-1006:25: AAPT: error: resource previously defined here. C:\\Users\\128953.gradle\\caches\\transforms-1\\files-1.1\\appcompat-v7-28.0.0.aar\\e266a3de4bfa13bf456f367854478beb\\res\\values\\values.xml:987:5-1006:25: AAPT: error: duplicate value for resource 'attr/iconTintMode' with config ''. C:\\Users\\128953.gradle\\caches\\transforms-1\\files-1.1\\appcompat-v7-28.0.0.aar\\e266a3de4bfa13bf456f367854478beb\\res\\values\\values.xml:987:5-1006:25: AAPT: error: resource previously defined here. Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

Get more help at https://help.gradle.org

BUILD FAILED in 1m 36s 13 actionable tasks: 12 executed, 1 up-to-date

as your error said :

duplicate value for resource 'attr/iconTint' with config ''.

so you have two or more attribute with name iconTint . just check your ressource and you can fix it with finding duplicate

It seems like you have a duplicated value for resource 'attr/iconTint'. The issue is related to the fact that this value exists both in design-28.0.0 and in appcompat-v7-28.0.0.

Try to invalidate the cache and restart Using the File menu od Android studio. If the issue continues, consider removing appcompat dependency as it should be already included in the design dependency.

It clealy shows that issue with Res folder . in your exception clearly shows that values folder has duplicated value iconTint . so remove that duplicate value. Keep coding :)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM