java - 更改了 build.gradle 现在无法安装应用程序删除失败内部错误

标签 java android gradle android-gradle-plugin build.gradle

我将我的 gradlescompileSdkVersion 从 21 更改为 22,然后忘记了它,一天后,我插入手机并想要调试我的应用程序,在尝试安装后收到此消息:

Installation failed since the device possibly has stale dexed jars that don't match the current version (dexopt error). In order to proceed, you have to uninstall the existing application.

WARNING: Uninstalling will remove the application data!

Do you want to uninstall the existing application?

点击“确定”按钮后,我收到此错误:

DEVICE SHELL COMMAND: pm uninstall com.themeteam.roeikashi DELETE_FAILED_INTERNAL_ERROR

这是我的 gradle 文件

apply plugin: 'com.android.application'

android {
    compileSdkVersion 21
    buildToolsVersion "21.1.2"

    defaultConfig {
        applicationId "com.themeteam.roeikashi"
        minSdkVersion 15
        targetSdkVersion 21
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:appcompat-v7:22.1.1'
    compile 'com.android.support:support-v4:13.0.+'
    compile 'com.parse.bolts:bolts-android:1.+'
    compile fileTree(dir: 'libs', include: 'Parse-*.jar')
    compile 'com.github.clans:fab:1.5.0'
    compile 'com.squareup.picasso:picasso:2.5.2'
    compile 'com.android.support:cardview-v7:22.1.1'
    compile 'com.android.support:recyclerview-v7:22.1.1'
}

我可以使用一些关于该怎么做的帮助,因为我删除了所有我能找到的与我的应用程序有连接的文件,但这似乎不起作用。 我还将compileSdkVersion改回21,但这不起作用。 提前致谢!

最佳答案

问题出在gradle文件中,compileSdkVersion不小心从21改为22,所以我不得不改回来,将buildToolVersion和目标sdk版本更改为最新版本。

评论太离谱了,我最终删除了所有手机缓存的数据,因为我的应用程序确实在手机本身上保存了一些数据,但这不起作用。 我只是想到我应该使用最新版本并修复了它。

这是新的 gradle

    apply plugin: 'com.android.application'

android {
    compileSdkVersion 22
    buildToolsVersion "22.0.1"

    defaultConfig {
        applicationId "com.themeteam.roeikashi"
        minSdkVersion 15
        targetSdkVersion 22
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:appcompat-v7:22.1.1'
    compile 'com.android.support:support-v4:13.0.+'
//    compile 'com.parse.bolts:bolts-android:1.+'
//    compile fileTree(dir: 'libs', include: 'Parse-*.jar')
    compile 'com.melnykov:floatingactionbutton:1.3.0'
    compile 'com.squareup.picasso:picasso:2.5.2'
    compile 'com.android.support:cardview-v7:22.0.0'
    compile 'com.android.support:recyclerview-v7:22.0.0'
}

关于java - 更改了 build.gradle 现在无法安装应用程序删除失败内部错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30442427/

相关文章:

java - Struts 2中使用ModelDriven上传文件Action类

android - 重叠 fragment 和触摸事件

java - 捕获错误输入异常

android - 任务 ':app:mergeDebugNativeLibs' 执行失败。在 native react

java - HTTPRequest 类无法识别,似乎没有 apache.jar?

java - hibernate 空间 mysql 5.7

hibernate - 从Netbeans JPA添加 hibernate 到现有的Jersey项目

android - 升级到 Gradle 5 和 Android Plugin 3.3 后,我的构建失败并显示 "Metaspace"

java - graphql-spqr 中 Double 值的 NaN 模型

android - 如何从 Android SharedPreference 获取文本条目?