Android Studio freezes on indexing
Asked Answered
M

11

10

my project was working well but suddenly when I ran it on my phone, Android Studio freezes and I should stop it from task manager. before this happens I installed "Geny motion" & "Virtual Box", but when the error occurred I uninstalled them. but the problem insisted.

android studio freezes on indexing

Solutions I've tried

  1. I uninstalled it and installed it again
  2. I unplugged and plugged in my device
  3. I disabled android indexing from setting

None of the above solutions worked.

Mazurka answered 28/7, 2016 at 5:38 Comment(6)
Did you try using the built-in emulator rather than your device?Tactual
Since the build process on an external device may tend to cause these problems at timesTactual
There may be other areas to be looked into, like any infinite loops running inside your code. Another thing is try connecting other devices rather than the same device.Strainer
@TaraWilfred - I just tried it and it freezes still.Mazurka
Are there any errors being output as it freezes? If so could you provide those in the question as well?Tactual
Happens like this to me then I run project then its already building or something like this. This is probably minor bug off Android Studio. Nothing you should worry about.Suzansuzann
M
18

I had today this exact problem. None of the above helped me until I found simple solution here Just run File -> Invalidate Cache and Restart That simple and it works!!!

Myrwyn answered 1/5, 2018 at 9:34 Comment(1)
Your are Killing it ! Simple and smart. ThxGeographer
G
5

Delete all Android Studio data - .gradle .android .androidstudio folders from your home folder. And all project build folders gradle and iml files.

Guilder answered 19/2, 2018 at 20:58 Comment(2)
For me this problem occurs when I am running test with coverage. But when gradle built is over and indexing starts (before actual running test starts) AS freezes to the hell :( Other options like invalidate and restart isn't working. I was really hoping this would help but didnt. Even in sample project if I am making test case of single add function it is freezing.Molecular
Removing ~/.android would delete at least one emulator in my installation.Dapper
F
4

This worked for me.

1.Close the project
2.Remove the project
3.Close Android Studio
4.Open it again
5.Open the project

Enjoy Coding!

Frodi answered 3/10, 2018 at 6:59 Comment(0)
M
1

I checked my java file and I saw somehow all the code in one of my java files was replaced with "NULL NULL NULL NULL....." I deleted the file and the application runs without a problem.

Mazurka answered 28/7, 2016 at 6:45 Comment(1)
Unbelievable. I had same cause and solution. My android studio froze when I was editing a kotlin file, I tried several times to write the same content, every time same crash. then I did "save all" after each paste, eventually it froze again at the exact same click where before and after that when I restarted (again) it got stuck on reindexing. I found this answer and it gave me the idea to delete the file and after that indexing got unstuck. NB! the answer I am commenting on, is from 2016, it is now 2023!!!!Trudge
B
1

Android Studio (3.1.3) froze on me while editing a source file. I waited and finally killed the process in Task Manager (Windows). Twice I tried to start up again and both times it got stuck with the "indexing..." message in the lower right. Both times I ended the process in Task Manager.

I looked in the source folder of the project I was working on. The source file I had been editing when it froze was "Receipt.java". There was another file in the src folder "Receipt.java__jb_tmp__". I deleted that file and Android Studio started up fine. It looks like I lost some edits, though.

When I did start up, it detected there had been some error and offered to submit a report.

But answered 26/6, 2018 at 5:40 Comment(0)
I
1

If the project is large & has a lot of modules, you might need to increase the Allocated Heap Size for Android Studio.

Go to Edit Custom VM Options from Help menu and increase the value for -Xms and -Xmx

This is what I'm using

-Xms2048m
-Xmx8192m
-XX:MaxPermSize=2048m
-XX:ReservedCodeCacheSize=1024m
-XX:+UseCompressedOops
Isomerous answered 7/2, 2022 at 5:44 Comment(0)
S
0

In my case color was declared as invalid, Android Studio ignored that and during building it froze. I had to remove the file, let it index, paste it back and fix the color string (it gave me error when I entered the pasted file)

Soong answered 8/2, 2018 at 9:6 Comment(0)
E
0

just rename project folder then open IDE, it will show

enter image description here

now rename back to origin folder name, click open project

it work on my case

Emeryemesis answered 23/3, 2018 at 7:14 Comment(0)
H
0

I have older project with sdk version 22, when I open it in android studio 3.1.2 on macOS. It keep indexing forever, everything was installed and configured properly but indexing loop never stopped.

Following worked for me

File > Invalidate caches/restart… > Invalidate caches/restart

Horrid answered 6/6, 2018 at 8:33 Comment(0)
L
0

Go to the File menu and click the option Invalidate Caches / Restart This will solve the problem ! Enjoy ;)

Loft answered 2/7, 2018 at 7:48 Comment(0)
T
0

In my case, Android studio was stuck longer at indexing at specific folder D:\Java\andsdk\sources\android-33 I deleted that folder (android-33) and restarted Android studio This trick worked for me and Android studio started working correctly

Tractile answered 12/6, 2023 at 12:52 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.