1

While building project I'm facing this error Android resource compilation failed

Android resource compilation failed

E:\Study\Android\Clients Projects\Smupp\Smupp 1.2.1\Smupp\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:5397: error: duplicate value for resource 'attr/fontFamily' with config ''. E:\Study\Android\Clients Projects\Smupp\Smupp 1.2.1\Smupp\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:5397: error: resource previously defined here.

Tried all previously asked similar questions, but they didn't helped. I'm stuck from 4 days.

build.gradle(app)
buildscript {
    repositories {
        maven { url 'https://maven.fabric.io/public' }
    }

    dependencies {
        classpath 'io.fabric.tools:gradle:1.28.0'
    }
}

import java.text.SimpleDateFormat

apply plugin: 'com.android.application'
apply plugin: 'io.fabric'

repositories {
    maven { url 'https://maven.fabric.io/public' }
}

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

android {
    dexOptions {
        jumboMode true
    }
    def versionMajor = 1 // 1 - 20000
    def versionMinor = 2 // 0 - 9
    def versionPatch = 1 // 0 - 99
    def buildNumber = 0 // 0 - 999 used for testing builds, excluded from release versionName
    def appName = "Smupp"
    compileSdkVersion 28
    defaultConfig {
        applicationId "com.smupp"
        minSdkVersion 16
        targetSdkVersion 28
        versionCode 1201001
        versionName "1.2.2"
        renderscriptTargetApi 19
        renderscriptSupportModeEnabled true
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
        //android.defaultConfig.javaCompileOptions.annotationProcessorOptions.includeCompileClasspath = true
        resConfigs "en"
        /*javaCompileOptions {
            annotationProcessorOptions {
                includeCompileClasspath false
            }
        }*/
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
    buildTypes {
        release {
            minifyEnabled false
            shrinkResources false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }

    lintOptions {
        abortOnError false
    }
    dexOptions {
        javaMaxHeapSize "4g"
    }

    buildToolsVersion '28.0.3'
}

dependencies {
    def supportLibVersion = '1.0.0-beta01'
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    androidTestImplementation('androidx.test.espresso:espresso-core:3.1.0-alpha4', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })

    implementation "androidx.appcompat:appcompat:1.0.2"
    implementation "androidx.legacy:legacy-support-v4:1.0.0"
    implementation "androidx.cardview:cardview:1.0.0"
    implementation "com.google.android.material:material:1.1.0-alpha04"
    implementation "androidx.recyclerview:recyclerview:1.1.0-alpha03"
    implementation "androidx.percentlayout:percentlayout:1.0.0"
    implementation 'com.google.android.material:material:1.0.0'

    implementation 'com.google.firebase:firebase-messaging:17.4.0'
    implementation 'com.google.android.gms:play-services-location:16.0.0'
    //implementation "com.google.android.gms:play-services-gcm:16.1.0"

    testImplementation 'junit:junit:4.12'
    implementation 'com.google.code.gson:gson:2.8.5'
    implementation 'com.squareup.picasso:picasso:2.71828'
    implementation 'com.squareup.okhttp:okhttp:2.7.5'
    implementation 'com.jakewharton:butterknife:10.1.0'
    implementation 'com.github.johnkil.android-robototextview:robototextview:2.4.3'
    implementation 'com.squareup.retrofit:retrofit:1.9.0'
    implementation 'com.facebook.android:facebook-android-sdk:4.40.0'
    implementation 'com.google.android.exoplayer:exoplayer:r1.5.8'
    implementation 'com.google.android.gms:play-services-maps:16.1.0'
    implementation 'com.googlecode.mp4parser:isoparser:1.1.20'
    implementation('com.twitter.sdk.android:twitter:2.2.0@aar') {
        transitive = true;
    }
}
Zoe
  • 27,060
  • 21
  • 118
  • 148

1 Answers1

-1

Seeing

values\values.xml:5397: error: resource previously defined here.

Try to rename fontFamily name from values.xml .

shizhen
  • 12,251
  • 9
  • 52
  • 88
  • there is no attrs.xml folder –  Mar 20 '19 at 06:37
  • check `values.xml` file. – shizhen Mar 20 '19 at 06:40
  • in values folder values.xml also not exists –  Mar 20 '19 at 06:48
  • from file explorer I've checked the path and renamed `fontFamily` to `fontsFamily` but It doesn't solved the problem. after rebuilding the project it is again renamed to `fontFamily`. I think `values.xml` file is read only and regenerated on building/running project. –  Mar 20 '19 at 11:51
  • values.xml is read only file, how you can suggest a change into a read only file. – Gaurav Bansal May 29 '20 at 16:51