Android Studio 3.0 布局预览渲染问题 [英] Android Studio 3.0 Layout Preview render issues

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

问题描述

我刚刚将我的 Android Studio 更新到最新的 3.0,然后布局预览不再工作.我尝试打开不同的项目,它们都有相同的渲染问题.当我检查时,我没有看到任何编译错误或 gradle 问题.到目前为止,我试过

I just updated my Android Studio to latest 3.0 and then the Layout Preview is not working anymore. I have tried open up different projects and they all have the same render issues. As I checked, I don't see any compile errors or gradle issues. So far, I tried

  • 构建项目
  • 刷新布局
  • 清理项目
  • 无效缓存/重新启动

以下附加的屏幕截图显示某些类无法启动,但我不明白为什么以及如何修复它们.非常感谢.任何提示都可以提供帮助.

The following attached screenshot shows that some classes cannot be initiated but I dont get why and how to fix them. Thank you very much. Any hints could help.

更新:Android Studio 3.0中的渲染错误似乎有重复的案例布局编辑器 但我的问题略有不同.上述链接问题的解决方案是通过澄清 Base.Theme.AppCompat.Light.DarkActionBar 下的父主题来将主题修改为更具体的主题.但是,我什至没有 ActionBar,所以我正在寻找 Theme.AppCompat.NoActionBar 的解决方案.

Updates: It seems there is a duplicate case at Render error in Android Studio 3.0 Layout Editor but mine problem is slightly different. The solution for above linked issue is to modify the theme to a more specific one by clarifying parent theme under Base.Theme.AppCompat.Light.DarkActionBar. However, I don't even have an ActionBar so I am looking for a solution for Theme.AppCompat.NoActionBar.

在更新到 3.0 之前,一切正常.我想知道我是否需要更改部署SDK/版本.

Before updating to 3.0, everything is fine. I wonder if I need to change deployment SDK/Version.

推荐答案

好的,我试图探索所有可能的解决方案,但没有成功.我终于通过更改部署 SDK/版本来解决这个问题.我全部更改为 26,它解决了我的问题.随着我测试的版本越来越低,似乎只有 26 版才能工作.

OK, I tried to explore every possible solution but no work. I finally figured it out by changing the deployment SDK/Version. I changed all to 26 and it fixed my problems. As I tested version lower and higher, it seems only ver 26 can work.

android {
 compileSdkVersion 26
 buildToolsVersion '26.0.2'
...
 defaultConfig {
  targetSdkVersion 26
...
 }
}
...
dependencies {
  compile 'com.android.support:appcompat-v7:26.0.0'
  compile 'com.android.support:design:26.0.0'
  compile 'com.android.support:support-v13:26.0.0'
  compile 'com.android.support:support-v4:26.0.0'
  compile 'com.android.support:palette-v7:26.0.0'
...
}

因此,如果 Android Studio 3.0 中的渲染错误的解决方案布局编辑器 不适合您.你可以试试 26.让我知道.

So if the solution at Render error in Android Studio 3.0 Layout Editor does not work for you. You can try 26. Let me know.

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

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