Skip to content
geeksforgeeks
  • Tutorials
    • Python
    • Java
    • Data Structures & Algorithms
    • ML & Data Science
    • Interview Corner
    • Programming Languages
    • Web Development
    • CS Subjects
    • DevOps And Linux
    • School Learning
    • Practice Coding Problems
  • Courses
    • DSA to Development
    • Get IBM Certification
    • Newly Launched!
      • Master Django Framework
      • Become AWS Certified
    • For Working Professionals
      • Interview 101: DSA & System Design
      • Data Science Training Program
      • JAVA Backend Development (Live)
      • DevOps Engineering (LIVE)
      • Data Structures & Algorithms in Python
    • For Students
      • Placement Preparation Course
      • Data Science (Live)
      • Data Structure & Algorithm-Self Paced (C++/JAVA)
      • Master Competitive Programming (Live)
      • Full Stack Development with React & Node JS (Live)
    • Full Stack Development
    • Data Science Program
    • All Courses
  • Java for Android
  • Android Studio
  • Android Kotlin
  • Kotlin
  • Flutter
  • Dart
  • Android Project
  • Android Interview
Open In App
Next Article:
Different Ways to fix "The APK file does not exist on disk" in Android Studio
Next article icon

Different Ways to fix "The APK file does not exist on disk" in Android Studio

Last Updated : 27 Mar, 2021
Comments
Improve
Suggest changes
Like Article
Like
Report

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);

       }

   }


Next Article
Different Ways to fix "The APK file does not exist on disk" in Android Studio

H

hemantjain99
Improve
Article Tags :
  • Android
  • Android-Studio

Similar Reads

    Different Ways to Fix "Error type 3 Error: Activity class {} does not exist" in Android Studio
    Whenever we try to launch an activity we encounter the error "Error type 3: Activity class {} does not exist" in the Android Studio. The MainActivity Page throws the error as: Error while executing: am start -n “LauncherActivity” -a android.intent.action.MAIN -c android.intent.category.LAUNCHER Star
    3 min read
    Different Ways to Fix "Android Studio Does not Show Layout Preview"
    Have you ever faced the problem in the android studio that it is not showing the layout preview while you are constructing a layout for your project? If yes, then this article will help you to solve this problem. Below is the screenshot of the empty layout which is the problem that we have solved: M
    3 min read
    Different Ways to fix "DELETE_FAILED_INTERNAL_ERROR" Error while Installing APK in Android Studio
    In Android Studio when building a new APK or while installing an application from Android Studio. You will get to see errors as shown in the title such as "DELETE FAILED INTERNAL ERROR". This error is generally due to conflicts in the APK version while installing a new Android app. This is how the e
    4 min read
    Different Ways to Create aar File in Android Studio
    Android Studio can be used to create an Android archive file (*.aar) that can contain classes and methods that make use of Android classes and related files. Like creating the Jar file, an Android project must be created first, then the Android library module can be created and added. The main diffe
    3 min read
    Different Ways to fix "Error running android: Gradle project sync failed" in Android Studio
    Gradle is one of the most important components of Android apps. It handles all the backend tasks and manages all the external dependencies which we will be going to use in building our Android Application. Sometimes due to any issue or after formatting of your pc. Some of the Gradle files may get de
    3 min read
geeksforgeeks-footer-logo
Corporate & Communications Address:
A-143, 7th Floor, Sovereign Corporate Tower, Sector- 136, Noida, Uttar Pradesh (201305)
Registered Address:
K 061, Tower K, Gulshan Vivante Apartment, Sector 137, Noida, Gautam Buddh Nagar, Uttar Pradesh, 201305
GFG App on Play Store GFG App on App Store
Advertise with us
  • Company
  • About Us
  • Legal
  • Privacy Policy
  • In Media
  • Contact Us
  • Advertise with us
  • GFG Corporate Solution
  • Placement Training Program
  • Languages
  • Python
  • Java
  • C++
  • PHP
  • GoLang
  • SQL
  • R Language
  • Android Tutorial
  • Tutorials Archive
  • DSA
  • Data Structures
  • Algorithms
  • DSA for Beginners
  • Basic DSA Problems
  • DSA Roadmap
  • Top 100 DSA Interview Problems
  • DSA Roadmap by Sandeep Jain
  • All Cheat Sheets
  • Data Science & ML
  • Data Science With Python
  • Data Science For Beginner
  • Machine Learning
  • ML Maths
  • Data Visualisation
  • Pandas
  • NumPy
  • NLP
  • Deep Learning
  • Web Technologies
  • HTML
  • CSS
  • JavaScript
  • TypeScript
  • ReactJS
  • NextJS
  • Bootstrap
  • Web Design
  • Python Tutorial
  • Python Programming Examples
  • Python Projects
  • Python Tkinter
  • Python Web Scraping
  • OpenCV Tutorial
  • Python Interview Question
  • Django
  • Computer Science
  • Operating Systems
  • Computer Network
  • Database Management System
  • Software Engineering
  • Digital Logic Design
  • Engineering Maths
  • Software Development
  • Software Testing
  • DevOps
  • Git
  • Linux
  • AWS
  • Docker
  • Kubernetes
  • Azure
  • GCP
  • DevOps Roadmap
  • System Design
  • High Level Design
  • Low Level Design
  • UML Diagrams
  • Interview Guide
  • Design Patterns
  • OOAD
  • System Design Bootcamp
  • Interview Questions
  • Inteview Preparation
  • Competitive Programming
  • Top DS or Algo for CP
  • Company-Wise Recruitment Process
  • Company-Wise Preparation
  • Aptitude Preparation
  • Puzzles
  • School Subjects
  • Mathematics
  • Physics
  • Chemistry
  • Biology
  • Social Science
  • English Grammar
  • Commerce
  • World GK
  • GeeksforGeeks Videos
  • DSA
  • Python
  • Java
  • C++
  • Web Development
  • Data Science
  • CS Subjects
@GeeksforGeeks, Sanchhaya Education Private Limited, All rights reserved
We use cookies to ensure you have the best browsing experience on our website. By using our site, you acknowledge that you have read and understood our Cookie Policy & Privacy Policy
Lightbox
Improvement
Suggest Changes
Help us improve. Share your suggestions to enhance the article. Contribute your expertise and make a difference in the GeeksforGeeks portal.
geeksforgeeks-suggest-icon
Create Improvement
Enhance the article with your expertise. Contribute to the GeeksforGeeks community and help create better learning resources for all.
geeksforgeeks-improvement-icon
Suggest Changes
min 4 words, max Words Limit:1000

Thank You!

Your suggestions are valuable to us.

What kind of Experience do you want to share?

Interview Experiences
Admission Experiences
Career Journeys
Work Experiences
Campus Experiences
Competitive Exam Experiences