Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Studio got very slow and constantly "updating indices"

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?

like image 343
daneejela Avatar asked Dec 07 '16 16:12

daneejela


People also ask

Why is Android Studio running so slow?

According to Android Studio's official system requirements, it takes at minimum 3 GB RAM to run smoothly. Honestly, its a lot and I believe that is the biggest cause of being it too slow all the time. The android developers are always complaining about the speed of Android Studio and how its slow ALL THE TIME.

Does Android Studio makes my computer slow?

Since Android Studio, by default, runs a Gradle build when you start up, it manifests as an extremely slow start-up. The problem is extremely easy to check for: While you are experiencing the symptoms of a slow Android Studio, press Ctrl - Alt - Delete and open Windows Task Manager.


4 Answers

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

Or use this

Invalidate Caches / Restart under "File Menu"

like image 56
Abhishek Sengupta Avatar answered Oct 16 '22 11:10

Abhishek Sengupta


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

like image 33
daneejela Avatar answered Oct 16 '22 11:10

daneejela


Also, you can try:

Files -> Invalidate Caches / Restart...

This worked for me.

like image 17
Rafael Baptista Avatar answered Oct 16 '22 11:10

Rafael Baptista


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

like image 5
Pratik Mohanrao Gondil Avatar answered Oct 16 '22 11:10

Pratik Mohanrao Gondil