Skip to content
Advertisement

GuideLine problem Android Studio – ClassNotFoundException

I have problem with GuideLine, does someone know the solution?

It look like the guideline is missing classes

The following classes could not be found: – android.support.constraint.Guideline (Fix Build Path, Edit XML, Create Class)

Logcat after button click:

Guideline problem

XML Code:

<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="350dp"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_gravity="center"
    android:layout_height="match_parent">

    <androidx.cardview.widget.CardView
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        app:cardCornerRadius="20dp">

        <androidx.constraintlayout.widget.ConstraintLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent">

            <android.support.constraint.Guideline               <!-- THAT'S THE PROBLEM -->
                android:id="@+id/guideline"
                android:layout_width="1dp"
                android:layout_height="wrap_content"
                android:orientation="vertical"
                app:layout_constraintGuide_percent="0.5"/>

           

           

            <!-- ... here are more similar textView's -->

            <TextView
                android:id="@+id/tv_batteryDrainNum"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginTop="32dp"
                android:text="0"
                android:textStyle="bold"
                android:textSize="25sp"
                app:layout_constraintRight_toRightOf="parent"
                app:layout_constraintLeft_toRightOf="@+id/guideline"
                app:layout_constraintTop_toBottomOf="@+id/tv_batteryDrain" />

        </androidx.constraintlayout.widget.ConstraintLayout>
    </androidx.cardview.widget.CardView>



</androidx.constraintlayout.widget.ConstraintLayout>

Build Gradle:

dependencies {

    implementation 'androidx.appcompat:appcompat:1.3.0'
    implementation 'com.google.android.material:material:1.4.0'
    implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
    implementation 'androidx.cardview:cardview:1.0.0'
    implementation 'com.google.firebase:firebase-auth:21.0.3'
    implementation 'com.google.firebase:firebase-database:20.0.4'
    implementation 'com.google.android.gms:play-services-maps:18.0.2'
    implementation 'com.github.anastr:speedviewlib:1.5.4'
    implementation 'androidx.gridlayout:gridlayout:1.0.0'
    testImplementation 'junit:junit:4.13.2'
    androidTestImplementation 'androidx.test.ext:junit:1.1.3'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'

}

Advertisement

Answer

Try to use androidx.constraintlayout.widget.Guideline instead of android.support.constraint.Guideline

            <androidx.constraintlayout.widget.Guideline
                android:id="@+id/guideline"
                android:layout_width="1dp"
                android:layout_height="wrap_content"
                android:orientation="vertical"
                app:layout_constraintGuide_percent="0.5"/>
User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement