Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 951
manabreak Avatar asked Jan 26 '18 17:01

manabreak


People also ask

Where will the status of building and running the project is shown in the Android Studio IDE?

The tool windows give you access to specific tasks like project management, search, version control, and more. You can expand them and collapse them. The status bar displays the status of your project and the IDE itself, as well as any warnings or messages.

What is build process in Android Studio?

The build process involves many tools and processes that convert your project into an Android Application Package (APK) or Android App Bundle (AAB). The build process is very flexible, so it's useful to understand some of what is happening under the hood.


1 Answers

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
like image 158
Gvstrmrgh Avatar answered Sep 22 '22 15:09

Gvstrmrgh