0

I ran into an error and SO posts pointed towards the app bringing in old android support libraries so I commented out ALL libraries except for gridlayout and still get the error.

I run ./gradlew :app:mergeDebugResources

and I get this error

> Task :app:mergeDebugResources FAILED
/Users/dean/.gradle/caches/transforms-3/15ab07d34a4d626045c832027cc75ca9/transformed/gridlayout-1.0.0/res/values/values.xml:2:4: Duplicate value for resource 'attr/orientation' with config 'DEFAULT' and product ''. Resource was previously defined here: com.vendsy.tray.app-mergeDebugResources-10:/values/values.xml:1503: .

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 /Users/dean/workspace/tray/monorepo/android/applications/POS/app/build/intermediates/incremental/debug/mergeDebugResources/merged.dir/values/values.xml. Cause: java.lang.IllegalStateException: Can not add resource (com.android.aaptcompiler.ParsedResource@32ec7d51) to table.). Check logs for more details.

I did have constraint layout like this post says but I commented that out and it is a later version too ->

androidx.constraintlayout:constraintlayout:2.0.2

How to get more information on this issue? The error is quite ridiculous not pointing to both resources that conflict and only telling me one of them.

I was able to attack the problem a completely different way and found out when I copy over resources to my aar library(I am moving code to re-usable location), the conflict is with attrs.xml(I have no idea what that file does/is). Specifically, in this code

<declare-styleable name="FlowLayout">
    <attr name="horizontalSpacing" format="dimension"/>
    <attr name="verticalSpacing" format="dimension"/>
    <attr name="orientation2" format="enum">
        <enum name="horizontal" value="0"/>
        <enum name="vertical" value="1"/>
    </attr>
    <attr name="debugDraw" format="boolean" />
</declare-styleable>

The orientation has to be renamed to orientation2. I did a refactor but it changed nothing else so I am not sure if I broke anything or not :(.

Dean Hiller
  • 19,235
  • 25
  • 129
  • 212

0 Answers0