Android Studio got very slow and constantly "updating indices"

34,154

Solution 1

For the others having the same problem:

My android studio returned back to its original performance (which was ok). It is hard to me to say what made an improvement because I have done lots of changes at once, here are few I recall:

  • replaced maven with -> jcenter()
  • set flag in properties to use default gradle wrapper
  • updated android studio to latest version (at the moment 2.2.3)
  • enabled gradle daemon - Configuration On Demand
  • invalidate cache and restart(few times)

some of it I have tried before asking this question, but I think all came back to normal when I did last update to Android studio 2.2.3

Solution 2

It also happened to me,I just Sync 'app' and it was solved...

Or use this

Invalidate Caches / Restart under "File Menu"

Solution 3

Also, you can try:

Files -> Invalidate Caches / Restart...

This worked for me.

Solution 4

Try to store Sdk on other drive and also try to invalidate cache and restart. Hope this helps

Solution 5

I just deleted the .idea folder and restarted Android Studio then I pressed button "Sync Project with Gradle Files"

enter image description here

and everything goes fine.

Share:
34,154
daneejela
Author by

daneejela

Updated on May 25, 2021

Comments

  • daneejela
    daneejela about 3 years

    There are more similar question on the SO, but I haven't found my answer on any of them so I am opening new one.

    I am using:

    Android Studio 2.2.3 (but was same with the 2.2.2) Gradle 2.14.1 JRE 1.8.0

    I am using it on the mac, OS X El Capitan (2.5 GHz, i5, 8GB RAM).

    It has been working great until few weeks ago, and now it is so painfully slow. Most of the time it is "indexing/updating indices".

    I am not that concerned about build time (it takes about 30-40sec, but I can live with that) as much as that constant indexing that makes coding almost impossible (overall responsiveness is pretty poor).

    Is there anything in my gradle files that could cause this?

    I do have some dependencies, but the app itself is relatively simple.

    build.gradle //app

    apply plugin: 'com.android.application'
    apply plugin: 'com.google.gms.google-services'
    
    android {
    
    compileSdkVersion 23
    buildToolsVersion "23.0.2"
    
    dataBinding {
        enabled = true
    }
    
    defaultConfig {
        applicationId "com.example.myproduct"
        minSdkVersion 19
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
    
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
       }
    }
    dependencies {
    
        compile fileTree(include: ['*.jar'], dir: 'libs')
        testCompile 'junit:junit:4.12'
        compile 'com.android.support:appcompat-v7:23.2.+'
        compile 'com.android.support:support-v4:23.2.+'
        compile 'com.android.support:recyclerview-v7:23.1.1'
        compile 'com.android.support:cardview-v7:23.1.1'
        compile 'com.android.support:design:23.2.+'
    
        compile 'com.jakewharton.threetenabp:threetenabp:1.0.4'
    
        compile 'com.squareup.retrofit2:retrofit:2.1.0'
        compile 'com.squareup.retrofit2:converter-gson:2.1.0'
        compile 'com.squareup.retrofit2:adapter-rxjava:2.1.0'
        compile 'com.squareup.picasso:picasso:2.5.2'
    
        compile 'io.reactivex:rxjava:1.0.10'
        compile 'io.reactivex:rxandroid:1.1.0'
    
        compile 'com.google.android.gms:play-services-auth:8.3.0'
        compile 'com.facebook.android:facebook-android-sdk:4.16.1'
    }
    

    build.gradle//project

     buildscript {
        repositories {
            jcenter()
        }
        dependencies {
            classpath 'com.android.tools.build:gradle:2.2.3'
    
            classpath 'com.google.gms:google-services:1.5.0-beta2'
    
           }
        }
    
        allprojects {
            repositories {
                jcenter()
            }
        }
    
        task clean(type: Delete) {
                delete rootProject.buildDir
        }
    

    P.S. I have enabled - offline work, parallel and daemon. I have increased VM heap size. I have uploaded to latest Android Studio. I have replaces maven with jcenter(). Is there anything I am missing?