Duplicate value for resource 'attr/font' with config "

Changhyun Eun picture Changhyun Eun · Dec 6, 2017 · Viewed 53k times · Source

I really do now know why I got this error and how can I solve it. Actually I am not sure What I did right before I got this error.

Error Msg: /Users/hyun/.gradle/caches/transforms-1/files-1.1/appcompat-v7-27.0.1.arr/25699caf34fef6313d6ec32013a1a117f/res/values/values.xml error:duplicate value for resource 'attr/font' with config". error: resource previously defined here

/Users/hyun/Desktop/Laftel-Android/app/build/intermediates/incremental/mergeDbugResources/merged.dir/values/values.xml duplicate value for resource 'attr/font' with config ". resource previously defined here.

Java.util.concurrent.ExecutionException:com.android.tools.appt2.Aapt2Exception:AAPT2 error: check for details Execution failed for task ':app::mergeDebugResources'. Error: java.utilconcurrentExcutionException:com.android.tools.aapt2.Aapt2Exception : AAPT2 error: check logs for details

Answer

Tarun Dholakiya picture Tarun Dholakiya · Apr 11, 2018

It may the concept that makes conflicts with the logic that we have previously used for apply Custom fonts.

Previously

We have used below code for creating the custom attribute for the font.

    <declare-styleable name="CustomFont">
        <attr name="font" format="string" />
    </declare-styleable>

What I change

In my case, this was the issue and I have resolved it by renaming the attr name

    <declare-styleable name="CustomFont">
        <attr name="fontName" format="string" />
    </declare-styleable>

This same thing may apply if you are using any third party library or Custom View with "font" property

As per suggestion by reverie_ss Please Check your res->values->attrs.xml