Different Ways to fix "DELETE_FAILED_INTERNAL_ERROR" Error while Installing APK in Android Studio - GeeksforGeeks

22 Mar, 2021
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 error dialog pops up on the screen
Failure: Install failed invalid apk
Error: While installing apk,
So in this article, we will take a look at solving this issue in 4 different ways.
Method 1: Uninstalling the APK which is present in your device or Emulator
Method 2: Updating the version code and version name of the apk in build.gradle file
Method 3: Disabling Instant run in Android Studio
Method 4: Disabling Instant run option in Android Studio using Shortcut keys 
Note: Method 3 and Method 4 work only in lower versions of the android studio below 3.0. 
To solve this issue the most common solution is to uninstall the apk which is already present in your device or emulator and then again install the APK in your device. This issue is generally caused when the version code of the installed apk conflicts with the apk version which we are trying to install in our android or emulator. So in this case we have to uninstall the apk and install the new apk. 
First of all, we have to uninstall the apk which is already installed in our device or emulator. After that, we will update the apk version name and version code of our application and then again install this application. For updating the version name and code of the apk we have to navigate to the build.gradle of our Android Studio project. Navigate to the app > Gradle Scripts > build.gradle(:app) and then update the version code and name in your Gradle file. You can get to see the code below. Comments are added in the code to get to know in more detail. Navigate to the android section in build.gradle file. 
android {
    compileSdkVersion 30
    buildToolsVersion "30.0.2"
    defaultConfig {
        applicationId "com.gtappdevelopers.gfg"
        minSdkVersion 19
        multiDexEnabled true
        targetSdkVersion 30
        // update version code to 2  
        versionCode 2
        // on below line we can update the version name on below line to 1.1
        versionName "1.1"

        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
  }  
After updating your version code now sync your project and again build your apk and run your application. This method will solve the issue. 
In this method, we will be disabling the instant run in our android studio so when installing a new apk in our emulator or android device the app will be installed in our device without any error. Below is the step-by-step implementation for disabling Instant run in your android studio. 
Note: This method works only in lower versions of the android studio below 3.0. 
Step by step guide for disabling the instant run feature:
Navigate to the Files option in the top bar of android studio. In that option click on the File > Settings. You will get to see this option on the below screen. 
After clicking on the settings option you will get to see the below screen. Inside this screen navigate to the Build, Execution, Deployment option and then click on the Instant run option.
Inside this screen, we have to uncheck the options which are shown on the above screen. 
After unchecking all the options we have to click on Apply option and then click on the OK option to save these changes and proceed further. 
In this method, we will be disabling the instant run in our android studio using shortcut keys so when installing a new apk in our emulator or android device the app will be installed in our device without any error. Below is the step-by-step implementation for disabling Instant run in your android studio. 
Note: This method works only in lower versions of the android studio below 3.0. 
Step by step guide for disabling the instant run feature: 
Press the shortcut key Ctrl + Shift + A and you will get to see a search bar after that search for an instant run option and then click on the Instant run option you will get to see the below screen. 
And rest of the work is same as method 3. 
Android-Studio
Picked
Android
Android
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Comments
Old Comments
Retrofit with Kotlin Coroutine in Android
Flutter - Custom Bottom Navigation Bar
How to Read Data from SQLite Database in Android?
How to Post Data to API using Retrofit in Android?
Android Listview in Java with Example
How to Add Image to Drawable Folder in Android Studio?
How to Change the Background Color After Clicking the Button in Android?
Animation in Android with Example
Auto Image Slider in Android with Example
MVP (Model View Presenter) Architecture Pattern in Android with Example