AppCompat не поддерживает текущую тему

Мое приложение работает отлично на Android N, но сбой на setContentView(R.layout.activity_main) на Android M:

 Caused by: java.lang.IllegalArgumentException: AppCompat does not support the current theme features: { windowActionBar: false, windowActionBarOverlay: false, android:windowIsFloating: false, windowActionModeOverlay: true, windowNoTitle: false }

Что странно, что я даже не редактировал ничего, что связано с моей темой приложения, и поэтому эта ошибка очень странная:

styles.xml:

<resources>

    <!-- Base application theme. -->
    <style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
        <!-- Customize your theme here. -->
        <item name="colorPrimary">@color/colorPrimary</item>
        <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
        <item name="colorAccent">@color/colorAccent</item>z
    </style>

    <style name="DialogStyle">
        <item name="android:windowFrame">@null</item>
        <item name="android:windowIsFloating">true</item>
        <item name="android:windowContentOverlay">@null</item>
        <item name="android:windowAnimationStyle">@android:style/Animation.Dialog</item>
        <item name="android:windowBackground">@color/textColorPrimary</item>
        <item name="android:windowSoftInputMode">stateUnspecified|adjustPan</item>
        <item name="android:colorBackgroundCacheHint">@null</item>
        <item name="android:textColorPrimary">@color/black</item>
    </style>

</resources>

FATAL EXCEPTION: главная                                                                                    Процесс: com.curlybraceapps.ruchir.rescuer, PID: 20394                                                                                    java.lang.RuntimeException: невозможно запустить активность ComponentInfo {com.curlybraceapps.ruchir.rescuer/com.curlybraceapps.ruchir.rescuer.MainActivity}: java.lang.IllegalArgumentException: AppCompat не поддерживает текущие функции темы: {windowActionBar: false, windowActionBarOverlay: false, android: windowIsFloating: false, windowActionModeOverlay: true, windowNoTitle: false}                                                                                        в android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2325)                                                                                        в android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2387)                                                                                        at android.app.ActivityThread.access $800 (ActivityThread.java:151)                                                                                        в android.app.ActivityThread $H.handleMessage(ActivityThread.java:1303)                                                                                        на android.os.Handler.dispatchMessage(Handler.java:102)                                                                                        на android.os.Looper.loop(Looper.java:135)                                                                                        at android.app.ActivityThread.main(ActivityThread.java:5254)                                                                                        в java.lang.reflect.Method.invoke(собственный метод)                                                                                        в java.lang.reflect.Method.invoke(Method.java:372)                                                                                        в com.android.internal.os.ZygoteInit $MethodAndArgsCaller.run(ZygoteInit.java:903)                                                                                        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)                                                                                      Причиняется: java.lang.IllegalArgumentException: AppCompat не делает поддерживают текущие функции темы: {windowActionBar: false, windowActionBarOverlay: false, android: windowIsFloating: false, windowActionModeOverlay: true, windowNoTitle: false}в android.support.v7.app.AppCompatDelegateImplV9.createSubDecor(AppCompatDelegateImplV9.java:474)                                                                                        в android.support.v7.app.AppCompatDelegateImplV9.ensureSubDecor(AppCompatDelegateImplV9.java:328)                                                                                        в android.support.v7.app.AppCompatDelegateImplV9.setContentView(AppCompatDelegateImplV9.java:289)                                                                                        в android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:140)                                                                                        в com.curlybraceapps.ruchir.rescuer.MainActivity.onCreate(MainActivity.java:152)                                                                                        at android.app.Activity.performCreate(Activity.java:6033)                                                                                        в android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1106)                                                                                        в android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2278)                                                                                        в android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2387)                                                                                        at android.app.ActivityThread.access $800 (ActivityThread.java:151)                                                                                        в android.app.ActivityThread $H.handleMessage(ActivityThread.java:1303)                                                                                        на android.os.Handler.dispatchMessage(Handler.java:102)                                                                                        на android.os.Looper.loop(Looper.java:135)                                                                                        at android.app.ActivityThread.main(ActivityThread.java:5254)                                                                                        в java.lang.reflect.Method.invoke(собственный метод)                                                                                        в java.lang.reflect.Method.invoke(Method.java:372)                                                                                        в com.android.internal.os.ZygoteInit $MethodAndArgsCaller.run(ZygoteInit.java:903)                                                                                        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)

Почему эта проблема возникает внезапно, хотя я вообще ничего не изменил с моей темой?

Ответ 1

Получение такой же проблемы, поэтому я обновляю свой стиль, как это, и его работу.

<style name="AppTheme.AppCompat.Light.NoActionBar.FullScreen" parent="@style/Theme.AppCompat.Light">
    <item name="windowNoTitle">true</item>
    <item name="windowActionBar">false</item>
    <item name="android:windowFullscreen">true</item>
    <item name="android:windowContentOverlay">@null</item>
</style>

Ответ 2

Смена родительской темы работала на меня

<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
        <item name="colorPrimary">@color/colorPrimary</item>
        <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
        <item name="colorAccent">@color/colorAccent</item>
</style>

Ответ 3

Два варианта.

Во-первых, попробуйте очистить и перестроить проект.

Два, измените определения, подобные этому, без "android":

<item name="windowActionBar">false</item>

<item name="windowNoTitle">true</item>