我在 android studio 中遇到这个错误
渲染问题
Failed to load AppCompat ActionBar with unknown error.
无法实例化一个或多个类
The following classes could not be instantiated:
- android.support.v7.widget.ActionBarContainer (Open Class, Show Exception, Clear Cache)
- android.support.v7.widget.ActionBarContextView (Open Class, Show Exception, Clear Cache)
- android.support.v7.app.WindowDecorActionBar (Open Class, Show Exception, Clear Cache)
Tip: Use View.isInEditMode() in your custom views to skip code or show sample data when shown in the IDE. If this is an unexpected error you can also try to build the project, then manually refresh the layout. Exception Details java.lang.ClassNotFoundException: android.view.View$OnUnhandledKeyEventListener Copy stack to clipboard
所以我找到了两个解决方案,但是有什么区别呢?我不想降级并可能遇到 future 的问题,而且我不知道其他解决方案 (2) 的作用。
解决方案 1 - 降级
解决方案 2 - 不确定它的作用
Failed to load AppCompat ActionBar with unknown error?
P.S android studio新手
最佳答案
正如多纳所说。但无需更改等级,只需更改样式 xml 文件:
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
为此:
<style name="AppTheme" parent="Base.Theme.AppCompat.Light.DarkActionBar">
不知道为什么,但它有效
关于android - 无法在 android studio 3.1.4 中加载 AppCompat ActionBar 并出现未知错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51805505/