2016-03-08 147 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給出錯誤,但是當使用<按鈕只能正常工作。是否有設計支持庫的錯誤? –