eee*_*eee 2 android android-support-library drawerlayout androidx
Cannot resolve class android.support.v4.widget.DrawerLayout即使在我的 build.gradle 文件中添加了 DrawerLayoutandroidx.drawerlayout:drawerlayout:1.1.1和 Materialcom.google.android.material:material:1.0.0实现之后,我仍然收到错误。
我尝试添加其他实现,例如com.android.support:support-compat:28.0.0和com.android.support:design:25.0.0,但错误仍然存在,并且应用程序无法启动。
知道如何解决这个问题吗?
构建.gradle:
apply plugin: 'com.android.application'
android {
    compileSdkVersion 30
    buildToolsVersion "30.0.2"
    defaultConfig {
        applicationId "edu.ktu.birthdaycalendar"
        minSdkVersion 21
        targetSdkVersion 30
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
        javaCompileOptions {
            annotationProcessorOptions {
                arguments = ["room.schemaLocation": "$projectDir/schemas".toString()]
            }
        }
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
}
dependencies {
    implementation fileTree(dir: "libs", include: ["*.jar"])
    implementation 'androidx.appcompat:appcompat:1.1.0'
    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
    implementation 'org.jetbrains:annotations-java5:15.0'
    implementation 'androidx.recyclerview:recyclerview:1.1.0'
    implementation 'androidx.drawerlayout:drawerlayout:1.1.1'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'androidx.test.ext:junit:1.1.1'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
    def room_version = "2.2.5"
    def lifecycle_version = "2.2.0"
    def arch_version = "2.1.0"
    implementation "androidx.room:room-runtime:$room_version"
    annotationProcessor "androidx.room:room-compiler:$room_version"
    // optional - RxJava support for Room
    implementation "androidx.room:room-rxjava2:$room_version"
    // optional - Guava support for Room, including Optional and ListenableFuture
    implementation "androidx.room:room-guava:$room_version"
    // optional - Test helpers
    testImplementation "androidx.room:room-testing:$room_version"
    //lifecycle
    implementation "androidx.lifecycle:lifecycle-viewmodel:$lifecycle_version"
    annotationProcessor "androidx.lifecycle:lifecycle-compiler:$lifecycle_version"
    androidTestImplementation "androidx.arch.core:core-testing:$arch_version"
    implementation "com.google.android.material:material:1.0.0"
    /*implementation "com.android.support:support-compat:28.0.0"
    implementation "com.android.support:design:25.0.0"
    implementation "com.android.support:appcompat-v7:27.1.1"
    implementation "com.android.support:support-v4:27.1.1"
    implementation "com.android.support:design:27.1.1"
    //implementation 'com.android.support.constraint:constraint-layout:1.1.0' */
}
您导入了错误版本的 DrawerLayout。android.support.v4.widget.DrawerLayout
它应该是 import androidx.drawerlayout.widget.DrawerLayout
| 归档时间: | 
 | 
| 查看次数: | 5979 次 | 
| 最近记录: |