android - 支持库 23.2.0 导致应用程序崩溃

android - support libraries 23.2.0 cause app to crash

我的应用程序在支持库 23.1.0 或 23.1.1 上运行良好,但当我开始使用 23.2.0 时,它在启动时崩溃。 我使用了五个支持库,但似乎使它崩溃的是这两个:

com.android.support:appcompat-v7:23.2.0

com.android.support:design:23.2.0

我的 galaxy nexus (API 17) 有这个问题,但我的 Nexus 7 (API 22) 没有。 有谁知道可能是什么问题? 这是我的 gradle 文件:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.2"

    defaultConfig {
        applicationId "com.ikarirobotics.aichordfinder"
        minSdkVersion 15
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:support-annotations:23.2.0'
    compile "com.android.support:appcompat-v7:23.2.0"
    compile 'com.android.support:design:23.2.0'
    compile 'com.android.support:cardview-v7:23.2.0'
    compile 'com.android.support:recyclerview-v7:23.2.0'
}

我的布局只是一个框架,我在其中放置了当前合适的片段:

<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/fragment_container"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context="HomeActivity"
    tools:ignore="MergeRootFrame" />

使用调试器,我发现崩溃发生在主要 activity 调用 setContentView():

java.lang.reflect.InvocationTargetException

java.lang.RuntimeException: Unable to start activity ComponentInfo{com.ikarirobotics.aichordfinder/com.ikarirobotics.aichordfinder.HomeActivity}: android.view.InflateException: Binary XML file line #36: Error inflating class android.support.v7.widget.Toolbar

我的 activity 扩展了 AppCompatActivity 并且我使用了支持操作栏。关于如何解决此问题的任何想法? :(

同样的事情发生在我身上。我部分修复了它在 support:design.

恢复到 23.1.1

在 23.2.0 版本的 Google 上似乎有一个可绘制的突变错误。 See the issue here. 在下一个错误修复版本发布之前,恢复到 23.1.1 应该没问题。

@CesarPim 是的,我对 CheckBox 也有同样的问题,尽管我可以通过在 drawable 文件夹中创建 abc_btn_check_material.xml 并添加以下行来解决这个问题我不能确定它接下来会在哪里中断.您可以在此 link 上找到可绘制对象和选择器代码: https://github.com/NativeScript/nativescript-plugin-appcompat/tree/master/platforms/android/appcompat/res/drawable

<?xml version="1.0" encoding="utf-8"?>

<selector xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:state_checked="true" android:drawable="@drawable/abc_btn_check_to_on_mtrl_015" />
    <item android:drawable="@drawable/abc_btn_check_to_on_mtrl_000" />
</selector>

我自己也遇到了问题。通过 SDK 管理器快速更新似乎已经解决了这个问题。

附带说明一下,我的 build.gradle 依赖项中的 none 实际上使用了 23.2.0,但我仍然收到错误。尝试 'downgrade' 到 23.1.1 对我来说不是一个选择,因为我已经在使用那个版本了。

正如这里的一些人预测的那样,当我开始使用 23.2.1 支持库时,问题就消失了。 谢谢大家的支持。