android - 仅 Lollipop 崩溃 "Failed resolution of: Landroid/support/v7/appcompat/R$styleable"

标签 android crash android-5.0-lollipop android-appcompat

当我启动我的应用程序时,我仅在 Lollipop 中遇到此崩溃。其他版本工作正常,例如4.4

java.lang.NoClassDefFoundError: Failed resolution of: Landroid/support/v7/appcompat/R$styleable;

pic1

pic1

出了什么问题?

编辑1:

android:minSdkVersion="8"
android:targetSdkVersion="22"

值/styles.xml:

<style name="AppBaseTheme" parent="Theme.AppCompat.Light">
    <item name="colorAccent">@color/colorPrimary</item>
    <item name="colorPrimary">@color/colorPrimary</item>
    <item name="colorPrimaryDark">@color/colorPrimary</item>
    <item name="android:windowNoTitle">true</item>
    <item name="windowActionBar">false</item>
    <item name="android:editTextStyle">@style/EditTextStyle</item>

</style>

<style name="AppTheme" parent="AppBaseTheme">
</style>
<style name="EditTextStyle" parent="Widget.AppCompat.EditText"/>
</resources>

values-v21/styles.xml:

<resources>
<style name="AppBaseTheme" parent="Theme.AppCompat.Light">
    <item name="android:colorAccent">@color/colorPrimary</item>
    <item name="android:colorPrimary">@color/colorPrimary</item>
    <item name="android:colorPrimaryDark">@color/colorPrimary</item>
    <item name="android:windowActionBar">false</item>
</style>

<style name="AppTheme" parent="AppBaseTheme">
</style>
</resources>

最佳答案

您正在使用 AppCompat 主题,因此您应该从 value-v21 中的主题内的命名空间中删除 android

而且它不需要 value-v21 样式。

关于android - 仅 Lollipop 崩溃 "Failed resolution of: Landroid/support/v7/appcompat/R$styleable",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29434644/

相关文章:

android - 如何使用 Rx 管理多个观察者,以便仅保持一个与服务的打开连接?

Android 崩溃报告诊断

android - 远程服务崩溃时 Activity 崩溃

iphone - 子类化导致崩溃时重新加载tableView

android - 失败 [INSTALL_FAILED_OLDER_SDK] Android-L

在最后一个屏幕上滑动时的 Android ViewPager

android - Kotlin 1.5.0 不适用于 Dagger 2?

android - 安排 JobService 仅在应用程序运行时运行(在前台)

java - 在新的 Android 5.0 中,方法 TextView.getTextColor(Context context, TypedArray typedArray, int defStyle) 在哪里消失了?

android - 上周未显示 DatePickerDialog