Android version 1.2 gradle is very slow

it was a time when I use Android Studio, and so far I have used 1.0.1, gradle was a little slow, about 1.5 minutes for assembleDebug (my project is really big!) but today I upgraded my AS to 1.2, and now This process takes from 7 to 10 minutes, and sometimes even without a result!

Is there any setting I have to change in order to make it faster? honestly taking 10 minutes for every debugging run is a nightmare!

Also in most cases, the use of my processor is 10%! (it actually doesn't work!) before, when the gradle worked, it was 100% almost all the time

+42
android android-studio gradle
May 04 '15 at 7:37
source share
5 answers

had the same problem.

I did to change the global gradle settings to offline work that can be done by going to Preferences => Gradle. It really mattered.

Another method that I saw when people use, but which I have not used yet, is to create gradle.properties in gradle, for example:

Just create a file called Gradle.properties in the following directory:

/home/<username>/.gradle/ (Linux) /Users/<username>/.gradle/ (Mac) C:\Users\<username>\.gradle (Windows) 

Add this line to the file:

 org.gradle.daemon=true 

Check out this link for more options, as well as a detailed explanation of gradle acceleration .

Hope this helps !.

+34
May 4 '15 at 8:23
source share

I have tested my app with Google+ login. So I added a signature for debugging. The application is assembled after ~ 26 seconds.

build.gradle Module: application file

 signingConfigs { debug { storeFile file(project.property("MyApp.signing")) storePassword project.property("MyApp.signing.password") keyAlias project.property("MyApp.signing.alias") keyPassword project.property("MyApp.signing.password") } } 

When I delete it ~ 7.5 seconds.

Next I tested the standalone class

File - Settings - assembly, execution ... - Assembly tools - Gradle - Work offline

enter image description here

Now my application is compiled in ~ 4.5 seconds.

Of course, I also added the inclusion - Compile independent modules in parallel (a larger heap size may be required) - Make the project automatically (only works when there is no / debugging)

File - Settings - assembly, execution ... - compiler

enter image description here

+12
Dec 10 '15 at 9:03
source share

The full answer for this problem is given below:

  • Update android studio to version 1.3 (stable) or higher 1.4 (beta at the time of writing).
  • Update gradle to 1.3. + (+ can be replaced with some positive number) change it in the build.gradle file.
  • change your gradle-wrapper.properties files and add distributionUrl=https\://services.gradle.org/distributions/gradle-2.4-all.zip to the last one (you can delete any old entry).
  • Go to Preference Gradle and set to work offline.

woila !!! I can compile and run the code in less than ~ 5 seconds ( I really mean )

+1
Sep 27 '15 at 20:12
source share

The reason may be multiDex,

turn multiDexEnabled to false in your build.gradle file (for debugging only, save it for release).

 android { ... defaultConfig { ... multiDexEnabled false ... } } 

In addition, you should consider using the latest version (2.4 at the moment) by editing the gradle-wrapper.properties file and setting 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

0
Jul 01 '15 at 6:18
source share

From the settings, go to the HTTP connection and disconnect any proxy server, and you will find the desired speed

-5
Jul 28 '15 at 7:01
source share



All Articles