android studio 1.2 gradle is very slow –

Development issue/problem:

I have been using Android Studio for a long time and until now I used version 1.0.1, the
gradle was a bit slow, about 1.5 minutes for assemblyDebug (my project is really big!)
, but today I updated my AS to 1.2 and now the same process takes about 7-10 minutes and sometimes no result!

Are there any parameters I should change to speed up the process?
Honestly, 10 minutes for every debugging run is a nightmare!

Also, my computer usually only uses about 10% of the time!
, because before, when Gradle was running, it was almost always at 100%.

How can I solve this problem?

Solution 1:

had the same problem.

What I’ve done is change the global ranking settings to make it work offline, which can be done under Options => Ranking. It really has made a difference.

Another method I’ve seen, but haven’t used yet, is to create gradle.properties in the gradle folder as follows:

Just create a file named gradle.properties in the following directory:

/home//.gradle/ (Linux)
/Users//.gradle/ (Mac)
C:Users/.gradle (Windows)

Add this line to the :

org.gradle.daemon=true

Follow this link to learn more about the features and for a detailed explanation of sorting gear.

HIH

Solution 2:

I tested my application by connecting to Google+. So I added the release signature to the debug version. It takes about 26 seconds to create an application.

module build.gradle : Application form

SignatureSettings {
debugging {
storeFile(project.property(MyApp.signing.log))
storePassword project.property(MyApp.signing.password)
keyAlias project.property(MyApp.signing.alias)
keyPassword project.property(MyApp.signing.log.password)
}
}

When I delete it, it’s ~7.5 seconds.

Then I tested offline

File – Settings – Assembly, Execution . – Assembly tools – Cradle – Offline operation

Enter a description of the image here

My application now builds in ~4.5 seconds.

Of course I also have
– Parallel compilation of independent modules (may require a larger stack size)
– Automatic project creation (only works if not running / debugging).

File – Parameters – Assembly, implementation… – Compiler

Enter a description of the image here

Solution 3:

The full answer to this question is below:

  • Update android studio to version 1.3 (stable) or higher 1.4 (beta at time of writing).
  • Update gradle to 1.3.+(+ can be replaced by a positive number), change it in your build.gradle file.
  • edit the files gradle-wrapper.properties and add distributionUrl=https://services.gradle.org/distributions/gradle-2.4-all.zip in the last file (you can remove any old entry).
  • Go to Preferences -> Cradle and set it to work offline.

Woyla!!! I can compile and run code in less than ~5 seconds (I’m serious).

Solution 4:

Could be caused by the multidex,

Set multiDexEnabled to false in your build.gradle file (for debugging purposes only, leave it for publication).

android {

defaultConfig {

multiDexEnabled false

}
}

In addition, you should consider using the latest version (currently 2.4) by editing gradle-wrapper.properties and installing gradle-2.4-all.zip.

distributionUrl=https://services.gradle.org/distributions/gradle-2.4-all.zip

What is MultiDex: https://developer.android.com/tools/building/multidex.html

Solution no. 5:

Go to the HTTP connection settings and disable any proxies to get the desired speed.

Good luck!

Related Tags:

 

Leave a comment

Your email address will not be published. Required fields are marked *