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

查看:122
本文介绍了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/Version来解决了. 我将所有更改为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天全站免登陆