问题
Android resource compilation failed
Output:
C:\projects\template\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:218: error: duplicate value for resource 'attr/layout_anchorGravity' with config ''. C:\projects\template\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:218: error: resource previously defined here.
Command:
C:\Users\music7.gradle\caches\transforms-1\files-1.1\aapt2-3.2.1-4818971-windows.jar\b9713b2bbe96f34444d44f2bfbbdc6b8\aapt2-3.2.1-4818971-windows\aapt2.exe compile --legacy \ -o \ C:\projects\template\app\build\intermediates\res\merged\debug \
C:\projects\template\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml Daemon: AAPT2 aapt2-3.2.1-4818971-windows Daemon #1
got this error plz give the solution
回答1:
This error took me forever to debug. But, at the end it all came down to whether you have made use of two "implementation" sources that do similar things. For example if you use a custom seekbar, from two different sources, both the seekbars will change the value of tools:max. This will cause the problem. It is the same reason why even you are getting the same error
error: resource previously defined here
If you have used two different implementation which are similar, remove one of them or comment and check it will be solved
来源:https://stackoverflow.com/questions/53368774/android-resource-compilation-failed-duplicate-value-for-resource-attr-layout-an