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

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

问题描述

我刚刚开始学习用于 Android 开发的 Kotlin,并启动了一个空项目并添加了一个活动.我已经添加了所需的 gradle 依赖项,如 Kotlin 文档中所述.默认情况下,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天全站免登陆