Android Studio Unknown attribute in xml and Namespace not found

14,989

Solution 1

It is very simple. Delete .caches file:

  1. Just close your AS.
  2. Go to .AndroidStudio3.2 folder.
  3. Delete the Caches file (path is: C:\Users\user\AppData\Local\Google\AndroidStudio2020.3\caches)
  4. Restart your AS.
  5. Enjoy.

NB: This Solution is for Android Studio 4+

if you are using Android Studio 3+ then delete cache from the following path

C:\Users\user.AndroidStudio3.x\system\caches

Solution 2

Ran into the same issue. I think that there's some specific bug related to this for Android Studio 3.2. My solution on Windows was to delete everything withing the cache/ folder in the .AndroidStudio3.2/ folder.

I tried everything that other's mentioned, sync gradle files, invalidate cache, removed the whole project and added it again. The only thing that worked for me was reinstalling the Android Studio. The second time that happened to me I decided to look for a better solution than reinstalling the whole Android Studio. Started playing with the cache files and figured out that deleting everything under the cache/ folder in the configuration folder of the Android Studio solved the problem.

Solution 3

This is problem with Android studio caches.

most probably syncing the project with gradle files will help

re sync from here

If no, you can manually delete cached files located on $HOME/.AndroidStudio3.2/system/caches and rebuild your project.

UPDATE: Gradle sync cache isses fixed in android studio 3.5 version. Update android studio to latest version can help.

Solution 4

100% Working

Do this two steps:

  1. Go to folder where you android studio caches are located. I have android studio 3.6.3 For me it's C:\Users\User_folder\.AndroidStudio3.6\system\caches.
  2. Go to the folder where you android studio projects are located. Open the project >then .idea folder and delete the caches. For me its C:\Users\User_folder\AndroidStudioProjects\Project_name\.idea\caches.

Solution 5

To "Sync Project with Gradle files" you don't have to change anything on your file. If you're on a Mac you just cmd + fn + F9 or cmd + shift + a (search action and type what's between double quotes). There's also a beautiful icon for that on Android Studio.

Share:
14,989

Related videos on Youtube

Ashik Vetrivelu
Author by

Ashik Vetrivelu

Updated on July 04, 2022

Comments

  • Ashik Vetrivelu
    Ashik Vetrivelu almost 2 years

    I recently got this warning in Layout and manifest files. I have attached those images below just check those in case for further clarification.

    The problem is I'm getting Namespace " is not bound warning and I cannot use the autocomplete code for xml files which can be generally used in android studio.Please help for this issue. The unknown xml attribute warning is displayed for each and every android attribute.

    http://i39.tinypic.com/2rr55k1.png

    http://i41.tinypic.com/2ns2s0w.png

    <?xml version="1.0" encoding="utf-8"?>
    
    <RelativeLayout
                  xmlns:android="http://schemas.android.com/apk/res/android"
                  android:orientation="vertical"
                  android:layout_width="match_parent"
                  android:layout_height="match_parent"
    
                  >
        <RelativeLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:background="@color/blue"
    
                >
        <TextView
            android:id="@+id/textView1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="text"
            android:textColor="@android:color/white"
            android:textAppearance="?android:attr/textAppearanceLarge"
            android:layout_margin="10dp"
            android:layout_above="@+id/editText"
            android:layout_alignLeft="@+id/editText"
            android:layout_marginBottom="15dp"/>
        <EditText
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:inputType="number"
                android:ems="15"
                android:padding="10dp"
                android:id="@+id/editText" android:layout_gravity="center"
                android:layout_centerInParent="true"
                android:background="@color/white"/>
        </RelativeLayout>
    
    </RelativeLayout>
    
  • Asym
    Asym over 5 years
    Kudos! You saved me a reinstall. I had tried everything else and nothing worked but this.
  • Naveen Rao
    Naveen Rao over 5 years
    You are a life saviour . I was about to reinstall android studio. THANKS !!
  • Pointyhat
    Pointyhat over 5 years
    Is this legit working? I tried to delete and before i would, the system found around 1.8gb of data. Should i really do it?
  • 4gus71n
    4gus71n over 5 years
    @Pointyhat I'm not really sure if we are talking about the same folder, move all the contents of your cache folder, to a backup folder just in case. I did that when I was trying all this.
  • Black_Zerg
    Black_Zerg about 5 years
    Thanks! Worked for me!
  • Sumit Kumar
    Sumit Kumar almost 5 years
    It really helped. Thank you so much.
  • Yakir Malka
    Yakir Malka over 3 years
    This actually what did the trick for me so thanks :)
  • Remc4
    Remc4 over 2 years
    Android Studio 2020.3 Arctic Fox has this folder in C:\Users\user\AppData\Local\Google\AndroidStudio2020.3\cache‌​s
  • ABHIMANGAL MS
    ABHIMANGAL MS over 2 years
    @PhpXp But I was unable to find this path C:\Users\user\AppData\Local\Google\AndroidStudio2020.3\cache‌​s
  • Remc4
    Remc4 over 2 years
    @ABHIMANGALMS try this path: %localappdata%\Google
  • ABHIMANGAL MS
    ABHIMANGAL MS over 2 years
    @PhpXp Yes, I got it because of you. I just updated the answer. Thanks ;)