manabreak
manabreak

Reputation: 5597

Android Studio doesn't build Java project on "Run"; requires manual build

I have a multi-module Java project, which I opened in Android Studio. Now, the project works otherwise fine, but when I click "Run", it won't build the project. Instead, it runs the old executable. I always have to first manually build the project so that it will run the most recent version.

What could cause this? My launch configuration seems correct (an "Application" config, with the correct main class and module). In my module's build.gradle, I have this:

apply plugin: "application"
apply plugin: "idea"

mainClassName = "me.manabreak.manray.EditorLauncher"
sourceCompatibility = 1.8

As per this Gradle documentation, this should be correct. I'm not sure why Android Studio / IDEA won't build before running.

Upvotes: 8

Views: 1575

Answers (1)

Gvstrmrgh
Gvstrmrgh

Reputation: 71

The following worked for me:

  1. Edit build configuration (click on the dropdown next to the run button and click Edit Configurations...)
  2. On the General Tab on the right (should be the default one that opens up) find the section labelled "Before launch" at the bottom of the tab page
  3. Click the plus and add Gradle-aware Make
  4. Use the arrows to move Gradle-aware Make above (before) Instant App Provision

Upvotes: 7

Related Questions