After recently upgrading my android studio, I am not able to build my project anymore.
Every time I execute a build, I am struck with the following error:
In my case it was malformed splash_screen.xml which was part of "reverted commit" which actually deleted this file, but somehow it was still may be it was in active changelist.
Fixed that file and solved issue.
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.
I faced the same problem while building a release version of my app the problem was that i had some important res
files of my project inside the debug
directory instead of having them inside the release
dir so i fixed the problem by moving the files that were in debug
inside release
you can check it by viewing your project tree under project
instead of android
In my case, it was a drawable resource file that required a higher API version as it was my minSdkVersion set in build.gradle. The main problem was that the file did not show any error until you opened it, so it was hard to find it at all. I have spent at least 4 hours trying other things, since as an error when building the project it showed other drawable resource files that did not have any problems at all. After removing the drawable that required the higher API the app built normally.
in my case i like this :
<?xml version="1.0" encoding="utf-8"?><?xml version="1.0" encoding="utf-8"?>
so i just remove one of them
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.