I just upgraded to Android Studio 3.0 mid-way through chapter 13, after completing listing 13.7. Now I get a build error related to fragment_crime_list.xml:
Error:error: attribute 'res-auto:showAsAction' not found.
Error:attribute 'res-auto:showAsAction' 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
This is the relevant code:
<?xml version="1.0" encoding="utf-8"?>
AAPT (Android Asset Packaging Tool ) can compile resources. I think you should look at this.
I assume that your gradle is version 3.0.0. You can try,
android.enableAapt2=false in your gradle.properties file and restarting the Gradle.
I’m using android studio 3.0. But I don’t use the above code.Because I didn’t encounter this the problem.
Or you can check newly released.
And check this and this.
Even though this has been solved already, I will still like to write about my general solution just to help others with similar issues
This error sometimes also comes as “Android resource linking failed” is another frequent and vague error in Android Studio. The solution sometimes could be quite boring and painful but I assure you, this error is absolutely nothing serious.
The Cause
The error shows up when Gradle encounters an error (Usually a syntax or typo error) in one or more of your XML files.
Most of the XML files are located in the res folder, however, you might still find some outside the res folder. For example, the AndroidManifest.xml located in “/src/main/AndroidManifest.xml”. Here is an example of a layout file that would give the “Error: failed linking file resources” error.
Solution
The solution to the error is obvious, right? All you have to do is go through each of your XML files to figure out where the error might be. This could sometimes be time-consuming but be rest assured that the error will disappear as soon as you find and fix the problem XML.
Tips to finding the problem XML quickly
If you have a lot of XML files and it would be just too difficult to go through them one after the other, you could use the following tips to make the process easier:
Undo: Most times, you are already halfway through a project before you experience this issue. Meaning that it was a recent change to one of your XML files that caused the issue. If that is the case, you can try to undo your recent change to the XML files. To undo, simply use the key combination: Ctrl+Z.