Skip to content
Related Articles

Related Articles

Different Ways to fix “The APK file does not exist on disk” in Android Studio
  • Difficulty Level : Easy
  • Last Updated : 27 Mar, 2021

Whenever we try to debug the application on Android Studio we encounter the error “The APK file does not exist on disk” in the Android Studio. The MainActivity Page throws the error as:

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

So, In this article, we will discuss 4 different methods for fixing the “The APK file does not exist on disk” error in Android Studio.

  • Method 1: Click on the Sync button
  • Method 2: “Gradle-aware Make” on the Before launch section
  • Method 3: Restart Android Studio
  • Method 4: Change the Apk Name

Method 1: Click on the Sync button

By clicking on the Sync button on Android Studio, we can easily resolve the error “The APK file does not exist on disk” in the Android Studio version till 3.1.



Method 2: “Gradle-aware Make” on the Before launch section

We are facing this same problem when we updated our Android Studio 3.1 or higher and, clean and fast method to resolve this error, and here, this is the solution:

  • Go to the Run > Edit Configurations…
  • Make sure you have already done “Gradle-aware Make” on the Before launch section:

  • To add:  click on + sign and select Gradle-aware Make and then, one popup will appear, just leave the text field empty.
  • Click OK and OK

Method 3: Restart Android Studio

We witnessed this issue also when we switch git branches. So, shutting down Android Studio:

 rm -rfv ~/Library/Caches/AndroidStudio* 

and Restart Android Studio is the solution to resolve this error “The APK file does not exist on disk”.

Method 4: Change the Apk Name 

Usually when project building fails, some common tricks you can try:

  • Build > Clean Project
  • Check Build Variants
  • Restart Android Studio (as above mentioned)

But to be more specific to issue- when Android Studio could not find the APK file on disk or in files which means that Android Studio has successfully built the project and generated the APK, but for some reason, Android Studio is not able to find the required file.

In this case, we can check the printed directory according to the log which will be helpful.



For example:

With Android Studio 2.0 Preview (build 143.2443734).

  • Checkout to a specific commit (so that it’s detached from the head): git checkout [commit_hash]
  • Run project
  • Android Studio tells: The APK file /Users/MyApplicationName/app/build/outputs/apk/app-debug-HEAD.apk does not exist on disk.
  • Go to the directory, there is a file actually named: app-debug-(HEAD.apk (with an extra parenthesis)
  • Run git branch

So here you could see, due to Gradle build script’s mistake, file naming is somehow wrong. 

The above scenario is just one example that can lead to this same error, but not necessary to be the same root cause as always. As a result, check your build.gradle script (you may change the apk name there, something like below):

applicationVariants.all { variant ->

       variant.outputs.each { output ->

           def newFileName = “whatever you want to name it”;

           def apk = output.outputFile;

           output.outputFile = new File(apk.parentFile, newFileName);

       }

   }

Want a more fast-paced & competitive environment to learn the fundamentals of Android?
Click here to head to a guide uniquely curated by our experts with the aim to make you industry ready in no time!
My Personal Notes arrow_drop_up
Recommended Articles
Page :