小编Par*_*ick的帖子

无法膨胀并且没有找到android支持设计BottomSheetBehavior的类行为

我正在尝试在我的主要项目中实现底部模式表。我在一个演示项目中成功地做到了。但是当我将相同的结构应用于我的主项目时,应用程序崩溃并出现以下错误:

android.view.InflateException:二进制 XML 文件第 40 行:无法膨胀行为子类 android.support.design.widget.BottomSheetBehavior 由:java.lang.RuntimeException:无法膨胀行为子类 android.support.design.widget.BottomSheetBehavior

AndroidRuntime:引起:java.lang.ClassNotFoundException:在路径上找不到类“android.support.design.widget.BottomSheetBehavior”:DexPathList[[zip file“/data/app/com.example...... ..]]]

我尝试了之前app:layout_behavior="@string/bottom_sheet_behavior"在我的 xml 中所述的内容,但没有奏效。

在演示项目中,底部工作表在嵌套父视图中正常工作。

我的主要项目依赖项是 -(添加到 app build.gradle)

    def lifecycle_version = "2.1.0-alpha02"
    def room_version = "2.1.0-alpha04"
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'androidx.appcompat:appcompat:1.0.0'
    implementation 'com.google.android.material:material:1.0.0'
    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
    implementation 'androidx.legacy:legacy-support-v4:1.0.0'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'androidx.test:runner:1.1.0'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0'
    implementation 'androidx.recyclerview:recyclerview:1.0.0'
    implementation 'com.github.bumptech.glide:glide:4.9.0'
    annotationProcessor 'com.github.bumptech.glide:compiler:4.9.0'
    implementation 'androidx.cardview:cardview:1.0.0'
    implementation 'me.relex:circleindicator:2.1.0'
    implementation 'com.squareup.retrofit2:retrofit:2.5.0'
    implementation 'com.google.code.gson:gson:2.8.5'
    implementation 'com.squareup.retrofit2:converter-gson:2.5.0'
    implementation 'com.github.chrisbanes:PhotoView:2.3.0'

    // ViewModel and LiveData
    implementation "androidx.lifecycle:lifecycle-extensions:$lifecycle_version"
    annotationProcessor "androidx.lifecycle:lifecycle-compiler:$lifecycle_version"
    implementation "androidx.room:room-runtime:$room_version"
    annotationProcessor "androidx.room:room-compiler:$room_version"
Run Code Online (Sandbox Code Playgroud)

android android-design-library androiddesignsupport bottom-sheet

4
推荐指数
1
解决办法
2614
查看次数