布局检查器错误。在模拟器中,应用程序不会更新旧布局

时间:2017-06-18 12:11:14

标签: android xml layout layout-inspector

我的布局检查器中出现未知错误。如果我的应用程序在模拟器下运行时根本不加载布局,那将不会有问题。我正在使用android O和支持库26.0.0-beta2。 Gradle发现没有错误。下面是日志:

    Rendering failed with a known bug. Please try a rebuild.  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)
 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.NoSuchFieldError: ViewBackgroundHelper   at android.support.v7.widget.AppCompatBackgroundHelper.loadFromAttributes(AppCompatBackgroundHelper.java:46)   at android.support.v7.widget.AppCompatImageView.<init>(AppCompatImageView.java:73)   `at android.support.v7.widget.AppCompatImageView.<init>(AppCompatImageView.java:66)   at java.lang.reflect.Constructor.newInstance(Constructor.java:423)   at android.view.LayoutInflater.onCreateView(LayoutInflater.java:717)   at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:785)   at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:727)   at android.view.LayoutInflater.rInflate_Original(LayoutInflater.java:858)   at android.view.LayoutInflater_Delegate.rInflate(LayoutInflater_Delegate.java:70)   at android.view.LayoutInflater.rInflate(LayoutInflater.java:834)   at android.view.LayoutInflater.inflate(LayoutInflater.java:492)   at com.android.layoutlib.bridge.bars.CustomBar.<init>(CustomBar.java:95)   at com.android.layoutlib.bridge.bars.NavigationBar.<init>(NavigationBar.java:52)   at com.android.layoutlib.bridge.bars.NavigationBar.<init>(NavigationBar.java:46)   at com.android.layoutlib.bridge.impl.Layout.createNavBar(Layout.java:284)   at com.android.layoutlib.bridge.impl.Layout.<init>(Layout.java:140) Copy stack to clipboard`   

我尝试重建,刷新,清除缓存,更改整个布局的代码。我觉得问题不在layouts'xml中,因为我也尝试从教程站点复制布局。同样的问题。

1 个答案:

答案 0 :(得分:3)

将支持库更改为26 alpha,问题已解决