Home » Android » Solved : AAPT: error: unbound prefix / file failed to compile

Solved : AAPT: error: unbound prefix / file failed to compile

When we tried to edit the existing layout XML in android by adding Material theme for EditText, but got the below error,

   > Android resource compilation failed
     /home/myuser/android_app/app/src/main/res/layout/fragment_name.xml:43: AAPT: error: unbound prefix.
         
     /home/myuser/android_app/app/src/main/res/layout/fragment_name.xml: AAPT: error: file failed to compile.

Solution :

In our resource xml file, following line was missing,

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

So, we changed /home/myuser/android_app/app/src/main/res/layout/fragment_name.xml to make it like,

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

xmlns:app="http://schemas.android.com/apk/res-auto"
    >

So, in your code it can be any Layout.


Subscribe our Rurban Life YouTube Channel.. "Rural Life, Urban LifeStyle"

Leave a Comment