将Holo应用更新为Material - INSTALL_FAILED

时间:2014-11-23 09:02:53

标签: android material-design

我有一个带有Holo风格的Android 4.x应用。现在我想添加对Material样式的支持,我想在Android 5和Android 4.x上都有Material样式(我已经在AppCompat v21中看到了这一点)。 我已经阅读了这篇关于从Holo到Material的“迁移”的帖子:http://android-developers.blogspot.sg/2014/10/appcompat-v21-material-design-for-pre.html

所以我改变了我的旧“build.grandle”文件:

apply plugin: 'com.android.application'

android {
compileSdkVersion 19
buildToolsVersion '19.1.0'

defaultConfig {
    minSdkVersion 15
    targetSdkVersion 19
    versionCode 18
    versionName "1.3.1"
}
buildTypes {
    release {
        runProguard true
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
        }
    }
}

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:19.1.0'
compile 'com.google.android.gms:play-services:4.4.52'
compile 'com.github.fernandodev.easyratingdialog:easyratingdialog:+'
}

到此:

apply plugin: 'com.android.application'

android {
compileSdkVersion 21
buildToolsVersion '20.0.0'

defaultConfig {
    minSdkVersion 15
    targetSdkVersion 21
    versionCode 19
    versionName "2.0.0"
}
buildTypes {
    release {
        runProguard true
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
        }
    }
}

repositories {
mavenCentral()
}

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:21.0.+'
compile 'com.google.android.gms:play-services:6.1.71'
compile 'com.github.fernandodev.easyratingdialog:easyratingdialog:+'
compile 'com.anjlab.android.iab.v3:library:1.0.+@aar'
}

我已将JDK6更改为JDK7(因为SDK21需要它),选择API21作为“compile sdk version”并创建一个新的XML文件“values / themes.xml”:

<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="Theme.MyTheme" parent="Theme.AppCompat.Light">
    <!-- Set AppCompat’s actionBarStyle -->


    <!-- Set AppCompat’s color theming attrs -->
    <item name="colorPrimary">#8bc34a</item>
    <item name="colorPrimaryDark">#259b24</item>

<!-- The rest of your attributes -->
</style>
</resources>

现在,当我尝试在我的设备上运行我的应用程序(使用Android 4.4,此时我没有安装了Android 5的设备),Android Studio在尝试安装之前,然后让我删除旧版本(但是没有旧版本。我删除它并删除所有文件夹)。当我确认收到错误时:

Uploading file
local path: C:\MYAPP\app\build\outputs\apk\app-debug.apk
remote path: /data/local/tmp/com.myname.myapp
Installing com.martinzone.topotafmobile
DEVICE SHELL COMMAND: pm install -r "/data/local/tmp/com.myname.myapp"
pkg: /data/local/tmp/com.myname.myapp
Failure [INSTALL_FAILED_DEXOPT]

我也试图“清除”我的项目,但在这种情况下我收到了这个错误:

Uploading file
local path: C:\MYAPP\app\build\outputs\apk\app-debug.apk
remote path: /data/local/tmp/com.myname.myapp
Installing com.myname.myapp
DEVICE SHELL COMMAND: pm install -r "/data/local/tmp/com.myname.myapp"
pkg: /data/local/tmp/com.myname.myapp
Failure [INSTALL_FAILED_UID_CHANGED]

有什么想法吗? 我该如何解决? 如何在Android 4和Android 5上添加Material Style支持?

0 个答案:

没有答案