Why is gradle so bad?

(jonnhytwoshoes) #1


I use Android Studio. I have a few questions:

  1. compilation times too long
  2. compiles everytime you run
  3. compiles whether you make a change or not
  4. if you generate a signed release apk, you have to wait till it’s finished compiling to tell you that the password doesn’t match

Can someone pls answer these fundamental questions?

(Ka-Ping Yee) #2

I have felt many of the same frustrations as you have. I am still learning about Gradle, but part of the answer I have learned is that unlike with most build systems, the build configuration is not declarative. Instead, the build configuration is itself a program (the “build script”) that Gradle executes in order to discover what to build. So Gradle has to run this program every time before it can even look to see what has or hasn’t changed. Unfortunately, for most projects, this build script is quite complicated and takes a while to run.

To be fair, the fact that the build configuration is a program gives Gradle a tremendous amount of power. But it is a shame that it is so slow.

(Carlo Luib-Finetti) #3

I have no knowledge with Android Studio; but sure I can tell you, it is not Gradle that is “so bad”. Either the integration into Android Studio or YOUR project/configuration.

The very first compile Gradle executes will do a check and compile all your buildscripts, then your will compile your project code. If you than repeat the build all you project’s sources should be UP-TO-DATE. Else, surely your gradle projects have a problem.

(jonnhytwoshoes) #4


Do you use gradle inside Android Studio? Can you please answer the
following questions:

  1. What parameter(s) is/are different when I run the app thro android
    studio which causes it to recompile/selecting the build apk menu option/and
    selecting the generate signed apk options? I want to copy files when I
    select “build apk” option, but not when I run the app which also leads to
    the apk being compiled
  2. When I run the app, it will compile, when I run app again, without
    changing anything it will recompile? why? is there a way to prevent this?