android-studioandroid-constraintlayoutfloating-action-buttonandroid-layout-editor

Android studio layout editor doesn't render


I have been working on a little project in Android Studio and I ran into a problem. In my layouts I've been using fabs and constraint layout yet when I try to open the editor I see a black screen, the app still runs fine. The message I got was: Exception raised during rendering: object is not an instance of declaring class

enter image description here

this is the XML for the layout:

<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
    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">


    <TextView

        android:id="@+id/Settings_text_view_ip_adress"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginStart="8dp"
        android:layout_marginTop="80dp"
        android:layout_marginEnd="8dp"
        android:text="IP adress"
        app:layout_constraintEnd_toStartOf="@+id/Settings_edit_text_ip_adress"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent"
        />

    <EditText
        android:id="@+id/Settings_edit_text_ip_adress"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_marginEnd="36dp"
        android:ems="10"
        android:hint="IP"
        android:inputType="number"
        android:digits="0123456789."
        app:layout_constraintBottom_toBottomOf="@+id/Settings_text_view_ip_adress"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintTop_toTopOf="@+id/Settings_text_view_ip_adress" />


    <com.google.android.material.floatingactionbutton.FloatingActionButton
        android:id="@+id/floatingActionButton10"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginEnd="8dp"
        android:layout_marginBottom="8dp"
        android:clickable="true"
        android:onClick="save_and_return_to_prev_activity"
        app:backgroundTint="#4CAF50"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:srcCompat="@drawable/settings_pic"
        />
</androidx.constraintlayout.widget.ConstraintLayout>

Solution

  • Update your Android Studio to the newest one