Android Studio 3.0布局编辑器中的渲染错误 [英] Render error in Android Studio 3.0 Layout Editor

查看:110
本文介绍了Android Studio 3.0布局编辑器中的渲染错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚开始学习Kotlin进行android开发,并开始了一个空项目并添加了一个活动.如Kotlin文档中所述,我已经添加了必需的gradle依赖项.默认情况下,MainActivity的xml文件仅包含一个TextView.但是,当我尝试在布局编辑器中预览xml时,它显示了渲染错误"

I just started learning Kotlin for android development and started an empty project and added an activity. I have added the required gradle dependencies as said in Kotlin docs. By default the xml file of MainActivity contains only a TextView. But when I try to preview the xml in Layout Editor it shows a "Render Error"

Render problem

Failed to load AppCompat ActionBar with unknown error.

我也得到这个

The following classes could not be instantiated:
- android.support.v7.widget.AppCompatImageView (Open Class, Show Exception, Clear Cache)
- android.support.v7.widget.ActionBarContainer (Open Class, Show Exception, Clear Cache)
- android.support.v7.widget.Toolbar (Open Class, Show Exception, Clear Cache)
- android.support.v7.widget.AppCompatTextView (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)
- android.support.v7.widget.ActionBarOverlayLayout (Open Class, Show Exception, Clear Cache)


Exception Details java.lang.ClassNotFoundException: android.support.v4.view.TintableBackgroundView

我尝试过手动重建项目并刷新布局.但是似乎没有任何作用.

I have tried rebuilding the project and refreshing layout manually. But nothing seems to work.

那我该怎么办?我正在将Kotlin与Android Studio 3.0 Canary 2配合使用

So what do I do? I'm using Android Studio 3.0 Canary 2 with Kotlin

已编辑

我已经取得了一些进展.我发现我的AppCompat主题均无效.

I have made some progress. I have found that none of my AppCompat Themes are working.

推荐答案

好吧,检查一下gradle,您是否在app/build.gradle文件中添加了support:appcompat依赖项?也是appcompat:design依赖项

Well, check your gradle , have you added support:appcompat dependency in app/build.gradle file ? also appcompat:design dependency

这篇关于Android Studio 3.0布局编辑器中的渲染错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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