Android Studio: Background task running indefinitely

后端 未结 10 1143
心在旅途
心在旅途 2020-12-23 16:10

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

Updating indices: Scannin

相关标签:
10条回答
  • 2020-12-23 16:15

    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...

    0 讨论(0)
  • 2020-12-23 16:16

    This was happening in my project every time I added a new Activity. So I included my R file in that class and it stopped.

    eg: import com.domain.appname.R;

    This fixed the problem.

    0 讨论(0)
  • 2020-12-23 16:20

    I'm also facing this issue, I've tried almost all the methods mentioned in this post, but none of them worked. The only solution that worked for me is to upgrade Android Studio to 3.5(which is still a test version at the time of writing this answer).

    0 讨论(0)
  • 2020-12-23 16:21

    In my case, it was a module circular dependency problem. It wouldn't show until I removed all the changes into all build.gradle files, then reopen it and apply the stash.

    It works :)

    0 讨论(0)
  • 2020-12-23 16:33

    I've this problem recently and in my case I'm using a linux 64bit SO and my android studio was in a ntfs disk. Since ntfs doesn't support executable permition the file fsnotifier64 was unable to execute and android-studio fallback into a compatibility mode that is much slower. The solution was copy the android-studio folder into my home folder that was ext4 and that way i was able to set permitions.

    0 讨论(0)
  • 2020-12-23 16:35

    The indexing is triggered through inotify on Linux.
    There is a limit to how many directories a single user can set watches on. If your project is large, then this limit may be exceeded, and Android Studio falls back to recursive scanning mode, which is very slow.

    To fix this, add this line to /etc/sysctl.conf file:

    # Increase the limit for Android Studio
    `fs.inotify.max_user_watches = 500000`
    

    Then run sudo sysctl -p.

    0 讨论(0)
提交回复
热议问题