skip to Main Content

I am trying to upgrade my old Android project and getting below errors :

> Task :app:mergeDebugResources FAILED
/home/jaiminmodi/.gradle/caches/transforms-3/08e5f3aa7ebe2a199cff2b386779108c/transformed/core-1.7.0/res/values/values.xml:162:4: Duplicate value for resource 'attr/font' with config 'DEFAULT' and product ''. Resource was previously defined here: com.brian.skyazul.activity.app-mergeDebugResources-16:/values/values.xml:2739: .

> Task :app:mergeLibDexDebug UP-TO-DATE
> Task :app:mergeDebugJniLibFolders UP-TO-DATE
> Task :app:mergeDebugNativeLibs NO-SOURCE
> Task :app:stripDebugDebugSymbols NO-SOURCE
> Task :app:validateSigningDebug UP-TO-DATE
> Task :app:writeDebugAppMetadata UP-TO-DATE
> Task :app:writeDebugSigningConfigVersions UP-TO-DATE

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:mergeDebugResources'.
> A failure occurred while executing com.android.build.gradle.internal.res.ResourceCompilerRunnable
   > Resource compilation failed (Failed to compile values resource file /home/jaiminmodi/StudioProjects/skyazul-android/app/build/intermediates/incremental/debug/mergeDebugResources/merged.dir/values/values.xml. Cause: java.lang.IllegalStateException: Can not add resource (com.android.aaptcompiler.ParsedResource@66c6c035) to table.). Check logs for more details.

* Try:
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.

* Exception is:
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':app:mergeDebugResources'.
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.lambda$executeIfValid$1(ExecuteActionsTaskExecuter.java:145)
    at org.gradle.internal.Try$Failure.ifSuccessfulOrElse(Try.java:282)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeIfValid(ExecuteActionsTaskExecuter.java:143)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:131)
    at org.gradle.api.internal.tasks.execution.CleanupStaleOutputsExecuter.execute(CleanupStaleOutputsExecuter.java:77)
    at org.gradle.api.internal.tasks.execution.FinalizePropertiesTaskExecuter.execute(FinalizePropertiesTaskExecuter.java:46)

What might be the issue?

2

Answers


  1. Chosen as BEST ANSWER

    Since it was older android project, the xml code of attr.xml file was look like as below :

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

    and as per the error, we can use font keyword for the value of name parameter. So the Solution is to change to some other value such as fontName

    So, I After change the updated file looks like as below :

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

    and done changes where this font was used to fontName

    That's All.


  2. Answer is below.

    /home/jaiminmodi/.gradle/caches/transforms-3/08e5f3aa7ebe2a199cff2b386779108c/transformed/core-1.7.0/res/values/values.xml:162:4: Duplicate value for resource 'attr/font' with config 'DEFAULT' and product ''. Resource was previously defined here: com.brian.skyazul.activity.app-mergeDebugResources-16:/values/values.xml:2739: .
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search