Tag Archives: Android studio preview

Failed to load AppCompat ActionBar with unknown error

Strong problem description:

In the preview of the xml corresponding to the activity in Android Studio, the layout design is not displayed properly, which gives an error.

The following classes cannot be instantiated:
– android.support.v7.widgetActionBarContainer (Open Class, Show Exception, Clear Cache)
– android.support.v7.widgetActionBarContextView (Open Class, Show Exception, Clear Cache)
– android.support.v7.appWindowDecorActionBar(open class, show exception, clear cache)
Tip: Use View.isInEditMode() in a custom view to skip code or display sample data in the IDE.
If this is an unexpected error, you can also try building the project and then manually refreshing the layout

Forced Modification Method:
In the style resource file, the

<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
</style>

is changed to:

<style name="AppTheme" parent="Base.Theme.AppCompat.Light.DarkActionBar">
</style>

then the test will show the corresponding layout!