如何修复这些缺失的类?
我将我的项目迁移到 Androidx,但在 xml 文件中出现这些错误(存在 ExpandableHeightGridView、TextView、SliderLayout、StickyScrollView、NotificationExpandableHeightListView、ExpandableHeightListView 和 EditText Java 类):
缺课。找不到以下类:
com.google.android.gms.appset.R
ExpandableHeightGridView (Fix Build Path, Edit XML, Create Class)
TextView (Change to android.widget.TextView, Fix Build Path, Edit XML, Create Class)
SliderLayout (Fix Build Path, Edit XML, Create Class)
StickyScrollView (Fix Build Path, Edit XML, Create Class)
NotificationExpandableHeightListView (Fix Build Path, Edit XML, Create Class)
ExpandableHeightListView (Fix Build Path, Edit XML, Create Class)
EditText (Change to android.widget.EditText, Fix Build Path, Edit XML, Create Class)
依赖库:
dependencies {
implementation 'androidx.appcompat:appcompat:1.6.1'
implementation 'com.google.android.material:material:1.9.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
implementation 'com.google.firebase:firebase-auth:22.1.1'
implementation 'androidx.annotation:annotation-jvm:1.6.0'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
implementation 'com.google.android.gms:play-services-maps:18.1.0'
implementation 'com.google.maps.android:android-maps-utils:3.5.2'
implementation 'com.daimajia.slider:library:1.1.5'
implementation 'de.hdodenhof:circleimageview:3.1.0'
implementation 'com.daimajia:library:1.1'
implementation 'com.guigarage:animations:0.7'
implementation 'com.daimajia.androidanimations:library:2.4'
implementation 'androidx.recyclerview:recyclerview-selection:1.2.0-alpha01'
implementation 'androidx.recyclerview:recyclerview:1.3.1'
implementation 'org.jetbrains:annotations:24.0.1'
implementation 'androidx.fragment:fragment:1.6.1'
implementation 'org.jetbrains:annotations:24.0.1'
implementation 'org.jetbrains:annotations:24.0.1'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
implementation "androidx.drawerlayout:drawerlayout:1.2.0"
implementation 'com.daimajia.androidanimations:library:2.4@aar'
implementation 'com.squareup.picasso:picasso:2.71828'
implementation 'de.hdodenhof:circleimageview:3.1.0'
implementation 'androidx.viewpager2:viewpager2:1.1.0-beta02'
implementation 'com.nineoldandroids:library:2.4.0'
implementation 'com.android.volley:volley:1.2.1'
implementation (platform('com.google.firebase:firebase-bom:32.2.2'))
implementation 'com.google.firebase:firebase-analytics:21.3.0'
implementation 'com.google.firebase:firebase-ads:22.2.0'
}
为什么要这么做?
无效并缓存重启Android Studio 清理并重建您的项目
**第 1 步:** Build.gradle(模块应用程序)- 顶部
apply plugin: 'com.android.application' apply plugin: 'com.google.gms.google-services'
**第 2 步:** Buld.gradle(project_name) - 波纹管依赖项
allprojects {
repositories {
google()
jcenter()
mavenCentral()
}}
同步您的项目并运行。
希望您的项目能够成功运行。