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 I delete 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, and i resolve the error in other files xml in drawable resource.
In my case , I used a wrong reference to the android resource file
i.e android:color/splash_bg
instead of @color/splash_bg
where splash_bg
represents my custom color resource declared in res/values/colors.xml file.
I had the same problem and I solved it when I added my icons in the drawable file to 24dp.
Copy any icon you want and paste it in the drawable file, and it will create (by default) 24dp icons.
Check your each and every XML and maybe you will find the following situation.
While coping code or files from other projects, maybe you forgot to add some resources like drawable, strings.
Check each drawable files, may Android Studio will highlight when you open that file.
Sometimes this type of error we have to find because of Android Studio stuck with errors.
In my case, the problem is code conflict, other person changed the same file with me. The resource code is changed. When I fix the file, the problem is gone.
while copy and pasting code I also pasted below line
<?xml version="1.0" encoding="utf-8"?>
Since,my xml file already contain above line and on adding this line it appear twice .
so I remove one of these line and it resolve my error