首页 > 解决方案 > 错误:找不到符号类 ActivityCompat

问题描述

我在我的 android 项目中遇到了问题

ERROR: Manifest merger failed : Attribute application@appComponentFactory value=(android.support.v4.app.CoreComponentFactory) from [com.android.support:support-compat:28.0.0] AndroidManifest.xml:22:18-91
is also present at [androidx.core:core:1.0.0] AndroidManifest.xml:22:18-86 value=(androidx.core.app.CoreComponentFactory).
Suggestion: add 'tools:replace="android:appComponentFactory"' to <application> element at AndroidManifest.xml:18:5-191:19 to override.

并在 gradle 属性中添加了这两行

android.useAndroidX=true
android.enableJetifier=true

现在我得到

error: cannot find symbol class ActivityCompat

我的 build.gradle 如下所示

implementation 'com.android.support:appcompat-v7:28.0.0'
/*implementation 'com.google.android.material:material:1.0.0'*/
implementation 'com.android.support:design:28.0.0'
implementation 'com.android.support:recyclerview-v7:28.0.0'
implementation 'com.android.support:cardview-v7:28.0.0'
implementation 'com.squareup.okhttp3:okhttp:3.8.1'

implementation 'com.github.bumptech.glide:glide:4.9.0'
annotationProcessor 'com.github.bumptech.glide:compiler:4.9.0'

implementation 'com.google.android.gms:play-services-maps:11.4.2'
implementation 'com.google.android.gms:play-services-location:11.4.2'
//implementation 'com.google.android.gms:play-services-places:11.4.2'
implementation 'com.google.android.libraries.places:places:1.0.0'

implementation 'com.google.firebase:firebase-auth:19.1.0'
implementation 'com.google.firebase:firebase-messaging:20.0.1'

implementation 'com.android.support.constraint:constraint-layout:1.1.0-beta2'
implementation 'com.google.code.gson:gson:2.8.1'

//implementation 'com.google.android.libraries.places:places-compat:1.1.0'
//implementation 'com.google.android.libraries.maps:maps-compat:2.0.0'
//implementation 'com.google.android.libraries.location:places-compat:2.0.0'
testImplementation 'junit:junit:4.12'

标签: android

解决方案


推荐阅读