Android Studio - XML Editor autocomplete not working with support libraries

I just started using the new android.support.design library. When using any of the widgets inside the XML editor I stop getting the XML autocomplete suggestions!

For example,

<android.support.design.widget.CoordinatorLayout
    android:id="@+id/header_root"
    android:layout_width="match_parent"
    android:layout_height="200dp">

    <ImageView
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="@color/primary_dark" />

    <android.support.design.widget.FloatingActionButton
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="bottom|right"
        android:src="@drawable/ic_action_add"
        android:layout_marginLeft="16dp"
        android:layout_marginRight="16dp"
        android:layout_marginTop="56dp"
        app:fabSize="normal"
        app:layout_anchor="@id/header_root"
        app:layout_anchorGravity="bottom|right|end" />

</android.support.design.widget.CoordinatorLayout>

None of the tags will show the autocomplete popup, like when I start typing "android:i" no popup appears, the only suggestion I get is shown in the following picture.

enter image description here

I have tried cleaning my project, restarting the pc, restarting Android Studio.. nothing is working!


Solution 1:

If NONE of the above answers worked, ...

Just navigate to your android studio installation directory, i.e,

yourDrive:/.AndroidStudio3.3/system

and DELETE THE CACHE FOLDER ( first close android studio, if its running ).

Then start Android Studio again. Done.

P.S I am using android studio 4.0

Solution 2:

I have tried a lot of things (restart Android Studio, PC, Invalidate Caches, Power Saver mode,...).

Finally, deleting the .idea folder and all .iml files from the project, restarting Android Studio, and rebuilding Gradle did the trick. Autocomplete in XML support library is working again.

Checking out files from Version Control or copying all the source files in a new project would do the trick as well.

Solution 3:

I got my autocomplete suggestions back by invalidating Caches and restarting.

File -> Invalidate Caches / Restart... -> Select Invalidate and Restart

Solution 4:

This same problem appeared in version 3.2. . The solution for that is

Close Android Studio
Go to C:\Users\UserName\.android and rename the build-cache folder to build-cache.bak

Go to C:\Users\UserName\.AndroidStudio3.2\system and rename these folders

caches to caches.bak

compiler to compiler.bak

compile-server to compile-server.bak

conversion to conversion.bak

external_build_system to external_build_system.bak

frameworks to frameworks.bak

gradle to gradle.bak

resource_folder_cache to resource_folder_cache.bak

Open the Android Studio and open your project again.

Solution 5:

If NONE of the above worked ...

Just navigate to your android studio installation directory, i.e,

yourDrive:/.AndroidStudio3.4/system

first close android studio, if its running.

then delete the cache folder in system

Then start Android Studio again. Done.

i am using android studio 3.4