2

I've just updated my android studio to latest version 1.5.1 but it constantly giving error when preview layout xml file (even when open new project). I am using android API 23 to preview. any help is much appreciate. Thanks

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

My layout file (This is auto generated by android studio)

<?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>

my 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'
}
Lê Khánh Vinh
  • 2,591
  • 5
  • 31
  • 77
  • can you check this link http://stackoverflow.com/questions/18195807/android-studio-rendering-problems – saeed Mar 08 '16 at 03:46
  • you see the rounded indicate section for my screen shot ... can you Adjust with your installed API Level that – saeed Mar 08 '16 at 05:45
  • Hi I adjust to 21 or 22 giving all blank (dont have any preview) – Lê Khánh Vinh Mar 08 '16 at 06:06
  • https://docs.google.com/document/d/16APWQippnSNr0_BWqDQd36kzRA6IpbsLSHKIt0xgEFY/edit. Herer is the screenshoot – Lê Khánh Vinh Mar 08 '16 at 06:09
  • better you need to install latest buildTool via the SDK Mangager. – saeed Mar 08 '16 at 06:11
  • bro before you installing you just rebuild and check it once again preview – saeed Mar 08 '16 at 06:14
  • I have clean and rebuild the project. Preview in design mode give no error API 22 and bellow but if switch to text there is blank. If change to API 23 then error come again. Very strange behavior – Lê Khánh Vinh Mar 08 '16 at 06:39
  • Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/105634/discussion-between-saeed-and-le-khanh-vinh). – saeed Mar 08 '16 at 06:45

1 Answers1

1

enter image description hereChange your android version on your designer preview into your current version depend on your Manifest. rendering problem caused your designer preview used higher API level than your current android API level.

Adjust with your current API Level. If the API level isn't in the list, you'll need to install it via the SDK Mangager.

saeed
  • 1,935
  • 1
  • 18
  • 33
  • Thanks for your respond. Can you give more detail about this? Here is my manifest? in my manifest generated by android studio there is now android API level. https://docs.google.com/document/d/16APWQippnSNr0_BWqDQd36kzRA6IpbsLSHKIt0xgEFY/edit – Lê Khánh Vinh Mar 08 '16 at 03:43
  • can you check this link http://stackoverflow.com/questions/18195807/android-studio-rendering-problems – saeed Mar 08 '16 at 03:45
  • I can see when using – Lê Khánh Vinh Mar 08 '16 at 04:04
  • "Change your android version on your designer preview into your current version depend on your Manifest". how do this, my manifest file does not have any version – Lê Khánh Vinh Mar 08 '16 at 05:37
  • I found that using appcompatButton give the error The following classes could not be instantiated: - android.support.v7.widget.AppCompatButton – Lê Khánh Vinh Mar 08 '16 at 08:24