This is the output of my Gradle console, I am unable to build my project
D:\Android Projects\....\app\src\main\res\layout\topic_view_header.xml
Error:error: resource attr/?? (aka -packagename- :attr/??) not found.
Error:error: resource attr/?? (aka -packagename-:attr/??) not found.
Error:error: resource attr/?? (aka -packagename-:attr/??) not found.
Error:resource attr/?? (aka -packagename-:attr/??) not found.
Error:resource attr/?? (aka -packagename-:attr/??) not found.
Error:resource attr/?? (aka -packagename-:attr/??) not found.
Error:failed linking file resources.
Error:java.util.concurrent.ExecutionException:
java.util.concurrent.ExecutionException:
com.android.tools.aapt2.Aapt2Exception: AAPT2 error: check logs for details
Error:java.util.concurrent.ExecutionException:
com.android.tools.aapt2.Aapt2Exception: AAPT2 error: check logs for details
Error:com.android.tools.aapt2.Aapt2Exception: AAPT2 error: check logs for
details
Error:Execution failed for task ':app:processDebugResources'.
> Failed to execute aapt
Information:BUILD FAILED in 27s
Information:11 errors
Information:0 warnings
Android Studio 3.0 RC 2
I just had this problem when trying to use data bind and declaring the layout tag. I know it is a bit late but for the sake of anyone encountering this problem, What I did to resolve the issue after so many attempts was that on your root layout when you are not using data bind say for example this
remove the
and just put it on your layout tag(that is if you are using data binding)
and hopefully it will work. the
android.enableAapt2=false
didn't work for me so I have to remove everything and try to figure out why I get the error when I put layout tag and use data binding thus I came up with the solution. Hope it helpsIn my case the real problem was that after generating Image Asset to generate launcher mipmap icon for my project, the generated file ic_launcher_foreground.xml had error inside (was wrongly generated). There was missing closing xml tag in the end of file, < / vector> was missing.
UPDATE
A new version of Gradle and Android-gradle-plugin is available that fixes these issues.
build.gradle (top level)
gradle-wrapper.properties
PREVIOUS ANSWER
If you disable AAPT2 you are just hiding the real issue.
Please be aware that
AAPT1
might be removed in the future therefore you are forced to useAAPT2
. Actually the migration guide isn't hard to follow since you don't see that much changes at the same time this way is future proof.Therefore you must check first if your really follow the correct Manifest structure as showed below.
This error message (AAPT2 error: check logs for details ) is not helpful because it doesn't tell you what the real problem is.
In my case, it was due to a missing resource XML drawable file.
I only figured out because I undid the changes in the XML file, and this time I got a more helpful message:
I had an error in my XML layout. So check your xml layout for errors.
As @Izabela Orlowska pointed out: In my case the problem occurred due to some files that could not be found inside the gradle cache folder. (Windows OS)
The default gradle path was inside my user folder. the path contained umlauts and a space. I moved the gradle folder by setting
GRADLE_HOME
andGRADLE_USER_HOME
environment variable to some newly created folder without umlauts or spaces in path. This fixed the problem for me.