Android Studio 3.1 "Run" not compiling code

The APK file /Users/MyApplicationName/app/build/outputs/apk/app-debug.apk does not exist on disk.

May be bug. You should change Settings.

You should open the Run/Debug Configurations dialog & select Run > Edit Configurations

Make sure, Gradle-aware Make is Added in TaskList or not. If not then click + & select from the options.

enter image description here

Note

If you receive

Shutdown finished in 0ms Error while generating dependencies split APK com.android.ide.common.process.ProcessException: Failed to execute aapt at com.android.builder.core.AndroidBuilder.processResources(AndroidBuilder.java:809) at com.android.builder.core.AndroidBuilder.processResources(AndroidBuilder.java:797) at com.android.build.gradle.internal.transforms.InstantRunSplitApkBuilder.generateSplitApkResourcesAp(InstantRunSplitApkBuilder.java:373)

You should Un-Check INSTANT RUN.

File-- Settings-- Build, Execution, Deployment -- Instant Run and uncheck Enable Instant Run.


clean your project and run again

If it's not work then

  • Step 1 Close your project.
  • Step 2 Go to your project folder and delete all build folder.
  • Step 3 run your project.

I have solution for your issue.

Also confirmed by Android Studio on Twitter : https://twitter.com/androidstudio/status/981914632892960768

  1. Edit your app configuration as below.

enter image description here

  1. Here you can see your app configuration as below.

enter image description here

  1. Here is missing Gradle-aware make attribute in before launch configuration. You can see here.

enter image description here

  1. Please add this Gradle-aware Make attribute through this way. Click on + icon and select Gradle-aware Make as seen in this screen.

enter image description here

  1. You can add this without writing any task just press OK button and task will be added and now it should look like this. Now apply changes and run your application.

enter image description here

It will solve this old apk installing issue on clean build in new Android Studio 3.1 issue.

Note : This issue is resolved in new Android Studio 3.1.1 Stable release.