AAPT error: resource drawable/... not found

In my case it was an xml selector. In the first line I had two of these (thanks to copy paste among my files):

<?xml version="1.0" encoding="utf-8"?>

and Android Studio didn't give any warning or something. Removing it fixed the problem but it needed a full clean build afterwards.


In my case I deleted namespace declaration duplicate like xmlns:android="http://schemas.android.com/apk/res/android"
and I used Analyse -> inspect code tool to show the error in the log, then I resolved the error in other files xml in drawable resource.


I fixed the error, which was probably coming from a mal-formatted copied XML file (probably some line-ending confusion)

Rewriting those fixed the error, although Android Studio displayed another file as the source of the problem, which in fact had nothing to do with the error itself.