Application will not run on device: DELETE_FAILED_

2020-06-08 16:54发布

问题:

Problem:

I made some changes to my gradle file and whenever I try to run my application I keep getting the error DELETE_FAILED_INTERNAL_ERROR after being told that the application path must be uninstalled then re-installed to run the app. I approve the uninstall and then the DELETE_FAILED_INTERNAL_ERROR is thrown and execution just outright stops.

Here is my gradle file:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 21
    buildToolsVersion "21.1.2"

    defaultConfig {
        applicationId "benyamephrem.tilt"
        minSdkVersion 14
        targetSdkVersion 21
        versionCode 19
        versionName "3"
    }
    buildTypes {
        release {
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:appcompat-v7:21.0.3'
    compile 'com.google.android.gms:play-services:7.0.0'
    compile 'com.nineoldandroids:library:2.4.0'
    compile 'com.daimajia.easing:library:1.0.0@aar'
    compile 'com.daimajia.androidanimations:library:1.0.8@aar'
}

Here is the ADB Logcat:

Installing benyamephrem.tilt
DEVICE SHELL COMMAND: pm install -r "/data/local/tmp/benyamephrem.tilt"
pkg: /data/local/tmp/benyamephrem.tilt
Failure [INSTALL_FAILED_DEXOPT]


DEVICE SHELL COMMAND: pm uninstall benyamephrem.tilt
DELETE_FAILED_INTERNAL_ERROR

I have installed all the sdk and build components needed as required by gradle. I also have uninstalled all apps with my package name from the device and the app still will not run.

Question:

What is DELETE_FAILED_INTERNAL_ERROR and why will the app not run?

回答1:

Try cleaning the project in Android Studio and then building it again. To clean the project click on Build > Clean Project.

I had the same issue and found this solution here.



回答2:

Open your project folder from command prompt and type: gradlew clean it will initiate downloading once done restart your android studio and run your program.



回答3:

I followed all the method, but what worked was

1.open command prompt.

2.change directory to project folder.

3.write command

gradle clean

now try building !



回答4:

In my case there was a unknown package name in my manifest.xml

for example i forgot to change "YOURPACKAGENAME" string to my app package name

android:protectionLevel="signature" />
    <uses-permission android:name="YOURPACKAGENAME.permission.C2D_MESSAGE" />


回答5:

Solution 1: clean the project: Build > Clean Project.

Solution 2: Disable Instead Run

Steps for windows: File > Settings > Build, Execution, Deployment > Instant Run > Uncheck : Enable Instant Run

Steps for mac: Android Studio > Preferences > Build, Execution, Deployment > Instant Run > Uncheck : Enable Instant Run

Solution 3: For Redmi users,

Go to Settings -> Permissions -> Install via USB: Uncheck your App if it's listed.

Go to Settings -> Additional Settings -> Privacy: Check the Unknown Sources option.

Go to Settings -> Additional Settings -> Developer options: Check the Install via USB option.

Go to Settings -> Additional Settings -> Developer options:Enable view attribute inspection

Finally, Go to Settings -> Additional Settings -> Developer options: Turn off MIUI optimization.

NOTE - Signin in to MI account is required to enable Install via USB option.

Reference: http://en.miui.com/thread-410773-1-1.html



回答6:

I had the same problem ..

The problem was that I did not have enough space, I uninstall some applications and works fine.



回答7:

If a Clean does not work, make sure your minSdkVersion does not equal the target sdk version, and that the device you are testing with equals or is higher than the minSdkVersion.

Fixed it for me, example in build.gradle:

minSdkVersion 21
targetSdkVersion 23


回答8:

I get this error almost after every Run command in the new Android Studio 2.2 Preview 6 version. To fix it faster instead of using Clean Project I'm using Make project. But this quick fix doesn't prevent the error from appearing again after a while.



回答9:

For Android Studio on Mac:

Navigation Bar:

Android Studio > Preferences > Build, Execution, Deployment > Instant Run > Uncheck : Enable Instant Run

For Android Studio on Windows :

File > Settings > Build, Execution, Deployment > Instant Run > Uncheck : Enable Instant Run