3

so today I stared at the code when suddenly XML editor (autocomplete) stop working properly. The problem is that when I type the first letter of some element it gives me a proper suggestion but when I start typing other letters it just stuck with the first one and when I confirm the suggestion it gives me 2 words, the first one is the world I type first and the second is the correct one. enter image description here

[1]: https://i.stack.imgur.com/aPAUc.png

MarGin
  • 2,078
  • 1
  • 17
  • 28

3 Answers3

5

It is very simple. Delete .caches file:

For Android Studio 4+

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

For Android Studio 3+

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

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

user7418129
  • 1,074
  • 14
  • 18
  • 1
    thanks a lot I didn't know the path (C:\Users\user\AppData\Local\Google\AndroidStudio2020.3\caches) you saved my day – mozhi jafr Dec 09 '21 at 13:03
1

I have tried different things(deleting .idea folder and .iml files from the project, invalidate cache and restart the Android Studio) nothing worked.

Finally, I close the Android Studio and navigate to android studio installation directory(i.e C:\Users\Your Username.AndroidStudio3.3\system) delete the Cache folder, run the android studio and it works for me.

tarun_sharma
  • 139
  • 1
  • 5
0

I have also faced the same issue, because of my Android Studio version

Android Studio Chipmunk | 2021.2.1 Patch 1 Build #AI-212.5712.43.2112.8609683, built on May 18, 2022

Try to update compile SDK to 31, hope it will get fixed.

android {
    compileSdk 31

...
}

Also check the ViewModel and appcompat version also, they should be matching the SDK version.

implementation 'androidx.appcompat:appcompat:1.4.1'
implementation 'com.google.android.material:material:1.6.0'
implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.5.1'
implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.5.1'
Bharat Lalwani
  • 1,277
  • 15
  • 17