我正在尝试对我的主要项目实施底层模式表。 我在一个演示项目中成功做到了。 但是,当我将相同的结构应用于主项目时,应用程序崩溃并显示以下错误:
android.view.InflateException:二进制XML文件第40行:无法为行为子类android.support.design.widget.BottomSheetBehavior充气原因:java.lang.RuntimeException:无法为行为子类android.support.design.widget.BottomSheetBehavior充气
AndroidRuntime:由以下原因引起:java.lang.ClassNotFoundException:在路径:DexPathList [[zip file“ /data/app/com.example ......]中找不到类“ android.support.design.widget.BottomSheetBehavior”。 ..]
我在xml中尝试了之前所述的app:layout_behavior="@string/bottom_sheet_behavior" ,但此操作无效。
在演示项目中,底部工作表可以在嵌套父视图中正常工作。
我的主要项目依赖项是-(添加到应用程序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"