android studio 1.2 gradle is very slow –
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?
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:
Add this line to the :
Follow this link to learn more about the features and for a detailed explanation of sorting gear.
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
When I delete it, it’s ~7.5 seconds.
Then I tested offline
File – Settings – Assembly, Execution . – Assembly tools – Cradle – Offline operation
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
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).
Could be caused by the multidex,
Set multiDexEnabled to false in your build.gradle file (for debugging purposes only, leave it for publication).
In addition, you should consider using the latest version (currently 2.4) by editing gradle-wrapper.properties and installing 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.