无法在Android Studio 3.1.4中加载带有未知错误的AppCompat ActionBar [英] Failed to load AppCompat ActionBar with unknown error in android studio 3.1.4

查看:99
本文介绍了无法在Android Studio 3.1.4中加载带有未知错误的AppCompat ActionBar的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在android studio中收到此错误

I am getting this error in android studio

渲染问题

Failed to load AppCompat ActionBar with unknown error.

无法实例化一个或多个类

Failed to instantiate one or more classes

    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 

所以我找到了两个解决方案,但是有什么区别?我不想降级,并且可能会遇到将来的问题,而且我不知道其他解决方案(2)的作用.

So I found two solutions but, what's the difference? I don't want to downgrade and possibly run into future problems and I don't know what the other solution(2) does.

解决方案1-降级

渲染错误android即使匹配了库版本,Studio仍无法加载appcompat操作栏

解决方案2-不确定其作用

Solution 2 - Not sure what it does

无法加载未知错误的AppCompat ActionBar吗?

P.S是android studio的新功能

P.S New to android studio

推荐答案

如多娜所说.但无需更改gradel,只需从以下位置更改样式xml文件:

As Dona said. But no need to change the gradel, Just change the styles xml-file from:

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

对此:

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

不知道为什么,但是有效

Don't know why, but it work

这篇关于无法在Android Studio 3.1.4中加载带有未知错误的AppCompat ActionBar的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆