Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Studio: Background task running indefinitely

After updating the Android SDK, I started Android Studio. Now its showing background task continuously running with message

Updating indices: Scanning files to index.

In this mode, it is nearly hanged and I can not work on it. Not able to find a way to stop background task. A restart of Android Studio didn't work either.

like image 571
Paramvir Singh Avatar asked Jul 24 '13 13:07

Paramvir Singh


People also ask

What is the current recommended way to handle long running background tasks Android?

Recommended solutionScheduling deferred work through WorkManager is the best way to handle tasks that don't need to run immediately but which ought to remain scheduled when the app closes or the device restarts.

Which component is used to run long running background in Android?

Android provides platform support to execute with and without a user interface. An Android service is defined as an application component that is generally used to perform long tasks in the background without needing user input.

What is deferred task in Android?

Deferred tasks Every task that is not directly connected to a user interaction and can run at any time in the future can be deferred. The recommended solution for deferred tasks is WorkManager.


2 Answers

I've find out that I should use the solution of @free3dom which is the Invalidate Caches / Restart option in the File menu.

I have to do this every time I change some project file by switching branches in GIT.

And yes, Android Studio really sucks and is full of bugs...

like image 81
Orabîg Avatar answered Oct 14 '22 05:10

Orabîg


Unplug all the phones and plug them again, it gets working. It is related to adb as stated here : https://code.google.com/p/android/issues/detail?id=172387 and a known bug that is to be fixed in the future

like image 28
Buddy Avatar answered Oct 14 '22 04:10

Buddy