java - 无法将 CoordinatorLayout 与 AndroidX 一起使用
问题描述
我正在尝试使用CoordinatorLayout
withAndroidx
但我有这个错误
The following classes could not be found: androidx.coordinatorlayout.widget.CoordinatorLayout
我不知道为什么我会得到这个错误,尽管我把它的依赖。
我也尝试更改版本,androidx.appcompat
但也遇到了同样的错误
构建.Gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 29
buildToolsVersion "29.0.2"
defaultConfig {
applicationId "com.example.bitprojecttask"
minSdkVersion 15
targetSdkVersion 29
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation "androidx.cardview:cardview:1.0.0"
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
//recycler view
implementation 'androidx.recyclerview:recyclerview:1.1.0'
//retrofit
implementation 'com.squareup.retrofit2:retrofit:2.4.0'
implementation 'com.squareup.retrofit2:converter-gson:2.4.0'
implementation "com.jakewharton.retrofit:retrofit2-rxjava2-adapter:1.0.0"
implementation 'io.reactivex.rxjava2:rxandroid:2.0.1'
//OKHTTP3 library
implementation "com.squareup.okhttp3:okhttp:3.11.0"
implementation "com.squareup.okhttp3:okhttp-urlconnection:3.11.0"
implementation "com.squareup.okhttp3:logging-interceptor:3.11.0"
//import json
implementation 'com.google.code.gson:gson:2.8.2'
//Butterknife
implementation 'com.jakewharton:butterknife:10.0.0'
annotationProcessor 'com.jakewharton:butterknife-compiler:10.0.0'
implementation 'de.hdodenhof:circleimageview:3.0.0'
implementation 'com.github.bumptech.glide:glide:4.10.0'
annotationProcessor 'com.github.bumptech.glide:compiler:4.10.0'
}
解决方案
您错过了为 Android 设计支持库添加材料
implementation 'com.google.android.material:material:1.0.0'
推荐阅读
- xamarin - Xamarin.ios 错误 MSB6006:“codesign”在尝试存档以进行发布时以代码 1 退出
- xslt - XSLT Multiple Input Values 有相同的标签,需要每行放置一个条件
- bash - 如何根据此 bash 脚本的结果将文本附加到每一行输出?
- python - 如何平滑时间序列的频谱?
- query-builder - Adonis 查询生成器:如何在关系上设置 .where 条件
- python - 在没有任何客户 ID 的情况下汇总客户支出
- coldfusion - 如何从 .cfc 文件调用 ColdFusion 函数?
- r - getMethod("summary", signature = "FitDiff") 中的错误
- python - ImportError:无法从“google.cloud”(未知位置)导入名称“texttospeech”
- css - (反应)边距自动不适用于我的分页栏