已更改 build.gradle 现在无法安装应用删除失败内部错误

Changed build.gradle now can't install app delete faild internal error

我将我的 gradles compileSdkVersion 从 21 更改为 22 并忘记了它,一天后我插入我的 phone 并想调试我的应用程序,在我尝试安装后此消息:

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和target sdk版本都改成最新版本。

评论太离谱了,我最终删除了所有 phone 的缓存数据,因为我的应用程序确实在 phone 本身上保存了一些数据,但没有用。 我突然想到我应该使用最新版本并修复了它。

这是新的 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'
}