Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Disable Gradle auto make in Android Studio

In Android Studio 0.2.0, whenever I type anything in my build.gradle files, Gradle decides it's time to rebuild. This takes a long time, generates noise and kills my battery life. It never ends as well, at least not until I finish editing the file… always rebuilding as I type. Lucky me I use Ubuntu with plenty of free memory.

So… I'd like to deactivate any option to auto make stuff. This is what I've tried so far:

  • Checking "File" | "Power Save Mode" in the menu.
  • Unchecking all options and all combinations between them in "Compiler" options, especially "Make Project Automatically".

Nothing works. I'd like a way to only build when I ask. Like a manual mode with a button. Something like that.

I understand Android Studio and the whole build system is very new, with lots of rough edges, but I'm hoping it's just a matter of an obscure flag definition in a file somewhere.


Previous research: this question does not provide enough details or goals, so I made my own. This G+ thread was a dead end as well. I'm still getting used to the new stuff and may be lost searching (i.e., missing the right keywords etc.), so sorry in advance if there are no updates on this issue.

Thank you.

like image 238
davidcesarino Avatar asked Jul 17 '13 18:07

davidcesarino


People also ask

How do I stop Gradle build?

Note that it requires you to have gradlew executable in the project directory (it's there by default when using Android Studio). After the installation you can find "Gradle Stop" button on Main Toolbar and inside Run Menu.

How do I enable Gradle offline mode?

If we need to use the offline mode, just go to the Gradle window and click the Toggle Offline Mode button: After we click the button to enable offline mode, we can reload all dependencies and find that offline mode works.

How do I disable Gradle in IntelliJ?

You can de-activate a Gradle project using the Ignore Gradle Project option. In this case, IntelliJ IDEA keeps the ignored Gradle projects and subprojects in the Gradle tool window, but stops their import (modules, content roots, tasks, and so on) to the project.


2 Answers

under preferences > Gradle you can disable auto-import. With it selected it'll reimport the gradle project (which right now builds it first) every time you change the file.

like image 158
Xavier Ducrohet Avatar answered Oct 03 '22 12:10

Xavier Ducrohet


Additionally, if you are using Kotlin build script (Kotlin DSL), after disabled auto-import like @Xavier said, you need one more step: uncheck the Auto Reload checkbox of KotlinBuildScript under preference -> languages & frameworks -> Kotlin -> Kotlin Scripting.

uncheck the auto-reload checkbox of KotlinBuildScript

like image 25
TonnyL Avatar answered Oct 03 '22 13:10

TonnyL