5

I have a project with about 20 modules inside. Gradle clean takes about 5min. As ell if i add a new module gradle update projects needs more than 5min.

There are no dependencies to external libraries. Dependencies are only inside the project between several modules.

I had same Project without gradle and it worked fine. I did not convert the old project to gradle. I have created a new project with the file structure recomended by gradle. But with this performance this is not very usefull...

Any idea what's going wrong with gradle?

user2861672
  • 51
  • 1
  • 1
  • 3
  • 1
    Apparently, it is still under heavy development. Meanwhile all we can do is just wait for some updates. Please take a look at this: https://plus.google.com/u/0/+RicardoAmaral/posts/e9PG6vSN5w3 – Alex Semeniuk Nov 07 '13 at 10:48

6 Answers6

8

Just create a file named 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

Source: https://www.timroes.de/2013/09/12/speed-up-gradle/

Yster
  • 3,147
  • 5
  • 32
  • 48
3

My Android studio in Ubuntu was too slow and I have done these things to speed up to very fast. in the welcome screen click (you can also go to it by file>close project)

 >configure>project default>
>code style > compiler > 
  click the following options 
     -make project automatically
     -use in process build
     -configure on demand
then in compiler (below the first one)
     - give build process heap size as 1000 or 1500
       (it will take a lot of RAM but Android studio will be extremely fast)
       give the same heap size for Android build and gradle build in the below tabs

Hope it will help

user1995307
  • 697
  • 6
  • 12
  • i have the same isues. eclipse is on fire where as studio is truggling to start.. experimental application should never be released to masses. – Yogamurthy Apr 15 '15 at 23:44
  • I agree. Many people have recipes about how to make it fast, but it's still slow. Something which you don't need in Eclipse. I just tested an old app in it. I swear I was feeling like crying how fast it build the app and showed up. – Juan Mendez Jun 17 '15 at 03:32
2

This could help too:

If you notice that Android Studio works slowly, consider the possibility to reduce the number of folders under antivirus protection.

Each antivirus check in your project consumes resources. You can significantly improve the performance, if you exclude certain folders from the antivirus protection.

Source: tip of the day from Android Studio.

Edit: The same point was made in the 2019 Google I/O talk: https://youtu.be/8rfvfojtRss?list=WL&t=756

Community
  • 1
  • 1
Muhammad
  • 425
  • 1
  • 6
  • 14
1

Set Custom VM options in Help-->EDIT Custom VM options.

-Xms1024m
-Xmx2048m
-XX:MaxPermSize=1024m
-XX:ReservedCodeCacheSize=256m
-XX:+UseCompressedOops

File-->Setting-->Build Executions

Compiler-->Command-line options set --offline.

Gradle-->check OfflineWork.

Launch SDK Manager--> Download HAXM Installer.

Now Android studio work like charm in Windows. Happy Coding:)

MIkka Marmik
  • 1,101
  • 11
  • 29
0

On Windows, I have found than my anti-spyware consider the jar files like archive. So I had exclude them from scan, but it's not very secure ....

letroll
  • 1,059
  • 1
  • 14
  • 36
0

I have a MacBook that I use for Android Studio and when I started out it was completely unusable taking 5 to 10 minutes for a build even for the smallest app. The Android emulator still does not work. Two things made the system usable. More memory added - I originally had 2GB and now have 8GB ... and using actual Android hardware connected via USB.

My MacBook spec is as follows - macOS Sierra Version 10.12.3 MacBook (13-inch, Mid 2010) Processor 2.4 GHz Intel Core 2 Duo Memory 8 GB 1067 MHz DDR3 Graphics NVIDIA GeForce 320M 256 MB Serial Number - oops!

The phone I use for build is an LG Sporty using Android 4.4.2 KitKat

Android Studio has the Intel HAXM extensions loaded and switched on.