【问题标题】:Lollipop only crash "Failed resolution of: Landroid/support/v7/appcompat/R$styleable"Lollipop 仅崩溃“无法解决:Landroid/support/v7/appcompat/R$styleable”
【发布时间】:2015-06-08 16:31:32
【问题描述】:

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

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

怎么了?

EDIT1:

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

值/样式.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>

【问题讨论】:

  • 你有什么style.xml
  • 你的 minSdk 和 targetSdk 是什么?
  • 您正在使用 AppCompat 主题,因此您应该在 values-v21 中从主题内的命名空间中删除 android
  • @GabrieleMariotti 是的,但是 AppCompat 是 android = 5 中它是本机运行的,所以必须有 'android' 标签,对吧?
  • @Gintas_ 不。它不需要 values-v21 样式或 android 命名空间

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


【解决方案1】:

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

它也不需要 values-v21 样式。

【讨论】:

  • 那么 values-v21 看起来如何?
【解决方案2】:

您可能正在使用 Android SDK 目录中的 AppCompat 库。 只需复制库文件夹并将其放在项目附近,然后从新位置将其重新导入 Eclipse。

【讨论】:

    猜你喜欢
    • 2016-05-04
    • 2023-04-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-01-23
    • 1970-01-01
    相关资源
    最近更新 更多