Android – Gradle causes lots of troube

Issue

with the newest version of Android Studio I’m forced to create my apps with Gradle.

I get several issues with this.

  1. At first: Why should I use Gradle at all? The traditional structure was logical and efficient.

  2. The app takes much longer for compiling because the Gradle excecutioner (or how this thing is called) needs to do some things every time. Any way to avoid this?

  3. My SVN is going crazy when working together with other people. It adds/removes files for scheduling, adding a library is not working and the settings are in chaos sometimes. Any best practices how to virtually enable SVN support for multi-users? I checked the .gradle files and ignored all those folders and files from my SVN but still the same issues.

Solution

I agree that Gradle adds a lot of unneeded complexity (for many projects), especially since it is not properly integrated into the IDE yet (i.e. a lot of file editing is required instead of changing options via configuration dialogs). That said, so much more can be achieved (build wise) by using Gradle, and it is definitely the right way to go – I just think they are forcing it on us prematurely. It is sad that they are removing the option to use the old build method from Android Studio, but this seems to be the way it is going.

I do think that eventually they will properly integrate Gradle into the IDE (they have already added a lot of stuff since initial release) at which point it will be quite painless to use and the advanced features will be easily available to all. This is something I think we can all look forward to.

At this point though, with Android Studio still in the early release alpha phase (and let’s be honest, Google has a track record of leaving products in pre-release/beta stages for years) it is probably better to not use Android Studio unless you really need the features offered by the Gradle build system.

The best solution for users that do not require any of the advanced features offered by Gradle is to use IntelliJ IDEA Community Edition instead of Android Studio. IntelliJ being the foundation on which Android Studio is built offers everything in AS, but still allows use of the original build system (in addition to Gradle). The transition is painless and you can keep Android Studio around if you ever need to use it for some reason.

I know that this does not directly answer your questions, but instead it might help you not have to ask them 🙂

As a final note, one thing you could do to speed up Gradle build is to set it to offline mode, as follows:

  • Enter settings File -> Settings
  • Go to: Compiler -> Gradle
  • Toggle the Offline mode setting at the bottom

Answered By – free3dom

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published