An upgrade to Android Studio 3.0 Canary 5 that raises "IllegalArgumentException: AppCompat does not support the current theme features."

I worked perfectly in my application using Android Studio 3.0 Canary 4, but after upgrading to Canary 5, the application will now work with:

Caused by: java.lang.IllegalArgumentException: AppCompat does not support the current theme features: { windowActionBar: false, windowActionBarOverlay: false, android:windowIsFloating: false, windowActionModeOverlay: false, windowNoTitle: false }
at android.support.v7.app.AppCompatDelegateImplV9.createSubDecor(AppCompatDelegateImplV9.java:474)  
at android.support.v7.app.AppCompatDelegateImplV9.ensureSubDecor(AppCompatDelegateImplV9.java:328)  
at android.support.v7.app.AppCompatDelegateImplV9.setContentView(AppCompatDelegateImplV9.java:289)  
at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:140)  
at com.bleachr.fan_engine.activities.BaseActivity.setContentView(BaseActivity.java:138)

I narrowed it down to what I think is the problem of loading application styles.

Exception mentions windowNoTitle: falsewhen I set this flag to true. Here are the relevant xml lines that I can think of:

styles.xml:

<style name="AppTheme.Base" parent="Theme.AppCompat.Light">
    <item name="colorPrimary">@color/colorPrimary</item>
    <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
    <item name="colorAccent">@color/colorAccent</item>
    <item name="windowActionBar">false</item>
    <item name="windowNoTitle">true</item>
    <item name="android:windowAnimationStyle">@style/WindowAnimationTransition</item>
</style>

<style name="AppTheme" parent="AppTheme.Base"/>

AndroidManifest.xml

    <application
...
        android:theme="@style/AppTheme"

I am not redefining the topic for this Action in any other way, so this should be ..

My initial thought somehow does not load windowNoTitle, otherwise it will be written as truein Exception. It makes sense?

? , / Canary 4. , , , .

: android:theme="@style/AppTheme" AndroidManifest !

. "invalidate and restart" Android Studio, , .

- v21/styles.xml - , , .

+4
1

android.enableAapt2=false gradle.properties? - .

, Canary 5, aapt1 . AppCompatDelegateImplV9.createSubDecor this.mWindowNoTitle , , : <item name="windowNoTitle">true</item>

// AppCompatDelegateImplV9
private ViewGroup createSubDecor() {
    TypedArray a = this.mContext.obtainStyledAttributes(styleable.AppCompatTheme);

    // ~~~~ERROR:  false returned (ignoring value from xml)
    if(a.getBoolean(styleable.AppCompatTheme_windowNoTitle, false)) {
        this.requestWindowFeature(1);
    }

- issuetracker.google.com?

0

Source: https://habr.com/ru/post/1680818/


All Articles