Unexpected namespace prefix "xmlns" found for tag LinearLayout Unexpected namespace prefix "xmlns" found for tag LinearLayout xml xml

Unexpected namespace prefix "xmlns" found for tag LinearLayout


Please try following:

Remove xmlns:android="http://schemas.android.com/apk/res/android from all the places excluding the ScrollView. I believe it is sufficient to inform it to the application once and in the outermost Layout or View of the xml file.


I encountered this problem multiple times with various codes.

The codes were running absolutely fine in the past but now they are showing these errors....

I found a very simple solution, doesn't require any code changes (Addition, edit or deletion).

Go to the Project Tab at the tabClick on the tabSelect the "Clean...." from the list

You will see the list of all the projects opened in your work space.

You can either select one project or all (I generally do "Clean all projects").Click Ok.The process takes around 5-7 sec for around 10 projects. All the XMLNS errors are resolved...You should try this before trying any other solution....This is like restarting the system for Window's error which resolves problems 70% of the times...

The above solution is more of a temp solution working in all situation..To avoid the situation in future, I all xmlns codes together at the top. (there may be a duplicate statement that may be required to be deleted)

I was having this issue when integrating Admob on the XML file.


In an Android xml file, the Android namespace can:

  • only be declared once
  • only be declared in the top ('outer') Android View in the xml hierarchy

or you'll receive an error when building the project. In your case, the top Android view is the ScrollView, so keep

xmlns:android="http://schemas.android.com/apk/res/android"

in the ScrollView, and remove it from all other nested Views, including the LinearLayout.