当前位置: 首页 > 知识库问答 >
问题:

GuideLine问题Android Studio-ClassNotFound异常

殷德本
2023-03-14

我对指南有问题,有人知道解决方法吗?

看起来指导方针是缺课

找不到以下类:-

单击按钮后的Logcat:

指南问题

XML代码:

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

建造格拉德尔:

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'

}

共有1个答案

令狐灿
2023-03-14

尝试使用androidx.constraintlayout.widget.Guide而不是android.support.constraint.Guide

            <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"/>
 类似资料:
  • 问题内容: 我正在学习Java并正在阅读这本书:https : //www.fca.pt/cgi- bin/fca_main.cgi/?op=2&isbn=978-972-722-791-4 。 在这本书中,我有一个Javaapplet练习。我可以在appletviewer中的Eclipse中运行它,并且运行良好。但是我无法将小程序集成到HTML中。 这是我的Java代码: 现在这是我的html代

  • 我决定写RMI(从书中)也从书中获取代码。我用rmic创建了存根,并启动了rmiregistry,但当我决定编写java启动服务器时,我遇到了一个问题,实际上我面临的问题是:java-classpath D:\RMI AddServer Exception:java。马绍尔群岛共和国。ServerException:服务器线程中发生RemoteException;唯一的例外是:java。马绍尔群岛

  • 我在使用以下简单示例时遇到了“ClassNotFound”异常的问题: 在本地模式下,按照文档提交会在第31行生成一个“ClassNotFound”异常,其中ClassToRoundTrip对象被反序列化。奇怪的是,前面28行的使用还可以: 但是,提交给本地开发人员主机仍然会产生相同的问题: 我可以从输出中看到JAR文件正在被执行器提取。 下面是其中一个执行程序的日志:

  • 问题内容: 大家好,我的课程在上面 我是jdbc的新手 请帮助我,我遇到运行时错误, java.lang.ClassNotFoundException:com.mysql.jdbc.Driver 感谢您的任何建议 注意:我不知道如何将jar文件放入我的类路径并动态绑定它:S 问题答案: 您需要下载MySQL Connector / J 并将.jar文件添加到您的应用程序中 将jar文件添加到中(如

  • 我正在使用JSF1.2和PrimeFaces3.5开发一个示例应用程序。我在桌面上有RAD并创建了一个新的动态web项目。我已经用primeface编辑器标记编写了xhtml文件。但是,当我管理这个项目的时候..它为FacesServlet抛出“java.lang.ClassNotFoundException”,尽管该servlet存在于类路径中。 我已经在我的类路径中添加了下面的jar.. my

  • 问题内容: 我的日历有问题。这是代码: 不能运行我的项目,因为在AndroidStudio显示错误,等…我得到nullPointException在模拟器运行时 它说 必须是以下之一:java.util.Calendar.DAY_OF_MONTHjava.util.Calendar.MONTH等… 我不明白此错误,因为它是其中之一 我有进口 对不起,我错过了它的初始化,但是还有另一个我想使用Cal