I just updated the support library from 27 to 28 and it is not successfully building with the following error:
Android resource compilation failed
Output: /AndroidProjects/Brand App/app/build/intermediates/incremental/mergeDebugResources/merged.dir/values/values.xml:1052: error: duplicate value for resource 'attr/strokeWidth' with config ''.
/AndroidProjects/Brand App/app/build/intermediates/incremental/mergeDebugResources/merged.dir/values/values.xml:1052: error: resource previously defined here.
Command: /Users/apple/.gradle/caches/transforms-1/files-1.1/aapt2-3.2.0-4818971-osx.jar/509e285e62be11c8bb7437cdd445c1df/aapt2-3.2.0-4818971-osx/aapt2 compile --legacy \
-o \
/AndroidProjects/Brand App/app/build/intermediates/res/merged/debug \
/AndroidProjects/Brand App/app/build/intermediates/incremental/mergeDebugResources/merged.dir/values/values.xml
Daemon: AAPT2 aapt2-3.2.0-4818971-osx Daemon #0
Faced the same issue, mine was attr/shape in config file, the issue is basically related to conflict of libraries that are using android default libraries, please paste the complete issue also update any thirdparty libraries you are using and it will work. I update one of the libraries and the issue is resolved. as i was using old version of com.facebook.shimmer and i just updated it in gradle and it worked.
This happened to me because I had the following attribute definition that conflicted with the new strokeWidth
in the android support library:
<declare-styleable name="CountdownView">
<attr name="widgetHeight" format="dimension" />
<attr name="widgetWidth" format="dimension" />
<attr name="animationDurationMs" format="integer" />
<attr name="animationRepeatCount" format="integer" />
<!-- strokeWidth was the conflict -->
<attr name="strokeWidth" format="integer" />
<attr name="paintTextSize" format="dimension" />
</declare-styleable>
The support library used format="dimension"
while I was using format="integer"
. Changing to format="dimension"
solved the problem, and was the correct format anyway:
<declare-styleable name="CountdownView">
<attr name="widgetHeight" format="dimension" />
<attr name="widgetWidth" format="dimension" />
<attr name="animationDurationMs" format="integer" />
<attr name="animationRepeatCount" format="integer" />
<!-- strokeWidth now matches support library -->
<attr name="strokeWidth" format="dimension" />
<attr name="paintTextSize" format="dimension" />
</declare-styleable>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With