I do not know how this error started to happen, I simply closed the android studio yesterday and I turned off the pc, today, I turned on the pc and opened the android studio, then this error appeared soon after opening the android studio.
What have I tried?
invalidate cache
rename and delete files that look like duplicates.
delete .gradle and clear / rebuild project
C:\Users\joaoa.gradle\caches\transforms-1\files-1.1\appcompat-v7-27.0.1.aar\70b6446a0ad42e67664086d0c5dca4d5\res\values\values.xml
C:\Users\joaoa\Desktop\MyPast\myProjects\project001\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml
Error:java.util.concurrent.ExecutionException:
com.android.tools.aapt2.Aapt2Exception: AAPT2 error: check logs for
details
Error:Execution failed for task ':app:mergeDebugResources'.
Error: java.util.concurrent.ExecutionException: com.android.tools.aapt2.Aapt2Exception: AAPT2 error: check logs for
details
Please open show log in files and delete all the files where you located and please restart your android studio.
if not solved then Again restart with option like InvalidDate Cache and Restart.
Hope this helps you.
check dependencies in gradle file.
2 or more libraries use in project conflict resource file.
example:
in library A,B in variables in arrts.xml or color.xml
I don't think this is a gradle version issue... I am using Android Studio 3.0 with Gradle Plugin Version 3.0.1 (which uses Gradle 4.1) THE LATEST. And I am getting this same issue. Just rename whatever attribute you've named tint to something like libTint or lib_tint or even more obscure ili_lib_tint so the issue can be resolved. I really want to use this lib and not look else where, please.
This is the xml element causing the issue
ImageLetterIcon/imageletter/src/main/res/values/attrs.xml
<declare-styleable name="TintableImageView">
Android studio creates many files that are not part of the normal source code. If you reboot without saving your project things may get whacked out but this could happen for no apparent reason. You have already cleaned your project so it regenerates some of these files. The .metadata file in the root of your workspace can be deleted but you will need to import all projects already in the workspace. I suggest you check the directory structure of your project using something other than android studio and even delete any generated folders as they will rebuild on the next compile. Perhaps even use a new workspace and copy source code over. First thing you should do is backup everything you want to keep as these suggestions could cause disaster if you are not careful. Consider version control, git repositories or github to save your project in the future as you can roll back to a previous state in the future
The solution works for me is to create a new values-v21 folder and put attr.xml in that, by this it would avoid merging your resources and by doing this your attr will work only from sdk 21 and above.