2016-03-08 153 views
2

我刚刚更新了我的android studio到最新版本1.5.1,但它在预览布局xml文件时(即使打开新项目时)也会不断发出错误。我正在使用android API 23预览。任何帮助非常感谢。由于渲染错误android studio

Rendering Problems The following classes could not be instantiated: 
- android.support.design.widget.FloatingActionButton (Open Class, Show Exception, Clear Cache) 

我的布局文件(这是由机器人工作室自动生成)

<?xml version="1.0" encoding="utf-8"?> 
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:app="http://schemas.android.com/apk/res-auto" 
    xmlns:tools="http://schemas.android.com/tools" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:fitsSystemWindows="true" 
    tools:context="com.example.vic.test2.MainActivity"> 

    <android.support.design.widget.AppBarLayout 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:theme="@style/AppTheme.AppBarOverlay"> 

     <android.support.v7.widget.Toolbar 
      android:id="@+id/toolbar" 
      android:layout_width="match_parent" 
      android:layout_height="?attr/actionBarSize" 
      android:background="?attr/colorPrimary" 
      app:popupTheme="@style/AppTheme.PopupOverlay" /> 

    </android.support.design.widget.AppBarLayout> 

    <include layout="@layout/content_main" /> 

    <android.support.design.widget.FloatingActionButton 
     android:id="@+id/fab" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_gravity="bottom|end" 
     android:layout_margin="@dimen/fab_margin" 
     android:src="@android:drawable/ic_dialog_email" /> 

</android.support.design.widget.CoordinatorLayout> 

build.gradle

apply plugin: 'com.android.application' 

android { 
    compileSdkVersion 23 
    buildToolsVersion '23.0.2' 

    defaultConfig { 
     applicationId "com.example.vic.test2" 
     minSdkVersion 15 
     targetSdkVersion 23 
     versionCode 1 
     versionName "1.0" 
    } 
    buildTypes { 
     release { 
      minifyEnabled false 
      proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 
     } 
    } 
} 

dependencies { 
    compile fileTree(include: ['*.jar'], dir: 'libs') 
    testCompile 'junit:junit:4.12' 
    compile 'com.android.support:appcompat-v7:23.2.0' 
    compile 'com.android.support:design:23.2.0' 
} 
+0

你可以检查这个链接http://stackoverflow.com/questions/18195807/android-studio-rendering-problems – saeed

+0

你看到我的屏幕截图圆形指示部分...你可以调整你的安装的API级别 – saeed

+0

嗨我调整到21或22给所有空白(没有任何预览) –

回答

1

enter image description here改变你对你的设计师预览Android版本到当前版本的依赖在你的Manifest上。渲染问题导致您的设计者预览使用比您当前的android API级别更高的API级别。

根据您当前的API级别进行调整。如果API级别不在列表中,则需要通过SDK Mangager进行安装。

+0

感谢您的回复。你能提供更多关于这方面的细节吗?这是我的清单吗?在我的清单生成的android工作室现在有android API级别。 https://docs.google.com/document/d/16APWQippnSNr0_BWqDQd36kzRA6IpbsLSHKIt0xgEFY/edit –

+0

你可以检查这个链接http://stackoverflow.com/questions/18195807/android-studio-rendering-problems – saeed

+0

我可以看到当使用<机器人.support.v7.widget.AppCompatButton给出错误,但是当使用<按钮只能正常工作。是否有设计支持库的错误? –