问题
My app was working fine until I deleted few layout files and activities. Since then its showing this error:
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.skaprer.jope/com.skaprer.jope.Controllers.LoaderActivity}: java.lang.IllegalArgumentException: AppCompat does not support the current theme features: { windowActionBar: false, windowActionBarOverlay: false, android:windowIsFloating: false, windowActionModeOverlay: false, windowNoTitle: false }
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2416)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476)
at android.app.ActivityThread.-wrap11(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5417)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
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.AppCompatDelegateImplV7.createSubDecor(AppCompatDelegateImplV7.java:422)
at android.support.v7.app.AppCompatDelegateImplV7.ensureSubDecor(AppCompatDelegateImplV7.java:279)
at android.support.v7.app.AppCompatDelegateImplV7.setContentView(AppCompatDelegateImplV7.java:253)
at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:109)
at com.skaprer.jope.Controllers.LoaderActivity.onCreate(LoaderActivity.java:39)
at android.app.Activity.performCreate(Activity.java:6251)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1107)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2369)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476)
at android.app.ActivityThread.-wrap11(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5417)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
My LoaderActivity file where error occurs :
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
TwitterAuthConfig authConfig = new TwitterAuthConfig(TWITTER_KEY, TWITTER_SECRET);
Fabric.with(this, new Crashlytics(), new TwitterCore(authConfig), new Digits());
setContentView(R.layout.activity_loader);
}
Theme files:
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<item name="colorPrimary">@color/primary_color</item>
<item name="colorPrimaryDark">@color/primary_dark_color</item>
<item name="colorAccent">@color/accent_color</item>
</style>
v21 :
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<item name="colorPrimary">@color/primary_color</item>
<item name="colorPrimaryDark">@color/primary_dark_color</item>
<item name="colorAccent">@color/accent_color</item>
<item name="android:navigationBarColor">#212121</item>
<item name="android:windowContentTransitions">true</item>
</style>
Ever since the change, the app fails to start. I tried changing the intent filter to start different activities to check if the error is particular for the activity but with every activity i tried, the error remains. What should I do?
回答1:
Try this
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
回答2:
It was an error because of the recent Android Studio 2.0 update, the IDE rebuilds the app for only the changed parts rather than rebuilding the whole thing. So I just clean and rebuild it, uninstalled the app from device and then run it. It worked.
回答3:
What version of AppCompat your are using?
It may be due to that AppCompat is now more strict on what it expect in theme window flags.
Try to add the next flag into your theme file:
<item name="windowNoTitle">true</item>
回答4:
JUST performing a 'clean' task has been solving my issuse. Seems once again to be one of these wierd Android Studio bugs.
来源:https://stackoverflow.com/questions/36617893/android-appcompat-does-not-support-the-current-theme-features-error