Reputation: 19793
I'm trying to get rid of the soon-to-be-removed option android.enableAapt2=false
from our project. It's been painful, but I hope I'm getting there.
Now I'm stuck with a BuildException: Failed to process resources, see aapt output above for details
.
The issue seems to be this:
error: style attribute '@android:attr/textColor' not found.
Message{kind=ERROR, text=error: style attribute '@android:attr/textColor' not found.,
sources=[/Users/<username>/.gradle/caches/transforms-1/files-1.1/appcompat-v7-27.1.1.aar/4215c9c9bb2efc5bb086ff343ac44128/res/values/values.xml],
original message=, tool name=Optional.of(AAPT)}
I've found the following question and answer, but I believe it's a bit different when it's not in our own project it's happening: Cannot complete Gradle Build, failed linking references
What's the reason for this happening and how can I solve it?
The specs:
Android Studio 3.1.2
JRE: 1.8.0_152-release-1024-b01 x86_64
buildToolsVersion: 27.0.3
Gradle: 4.6
Gradle plugin: 3.1.2
Edit:
Just in case I removed every single line of styles and attributes from our project and did a clean build and invalidation of cache and restart and everything, but the build was still pointing its finger at the values.xml
of com.android.support:appcompat-v7:27.1.1
.
Upvotes: 6
Views: 4985
Reputation: 1744
I had the same issue and found out that the main problem was that aapt2 did not report the problem location correctly.
Do a global search of all your style xml files for name="@android
.
This is part of <item name="@android:...
You need to remove the @ character.
I have found this line in one of the files: <item name="@android:textColor">#FF000000</item>
aapt2 reported correctly issues with other locations where it found the @ character, but for some reason, it didn't report it correctly in this case.
You may need to search shared files or even library aar files if you have any.
Upvotes: 7