问题描述
我无法使用android.support.v7.app.AppCompatActivity
。它在import android.support.v7.app.AppCompatActivity;
上显示错误,如下所示:无法解析符号'v7'。我什至在implementation 'com.android.support:appcompat-v7:28.0.0'
中添加了build.gradle
。
在android.useandroidX=true
中将android.enableJetifier
和gradle.properties
设置为false后,上述错误得以解决,但我收到如下错误:错误:清单合并失败:[com.android.support:support-compat:28.0.0] AndroidManifest.xml:22:18-91的属性application @ appComponentFactory value =(android.support.v4.app.CoreComponentFactory)
也存在于[androidx.core:core:1.5.0-alpha02] AndroidManifest.xml:24:18-86 value =(androidx.core.app.CoreComponentFactory)。
建议:在AndroidManifest.xml:5:5-20:19的元素上添加'tools:replace =“ android:appComponentFactory”'以覆盖。
即使在{{ 1}},我遇到了同样的错误。
我正在使用tools:replace="android:appComponentFactory
和AndroidManifest.xml
。
解决方法
这主要是因为您将Androidx与v28支持库一起使用,如果您使用androidx库,则可以删除v28库,如果您使用v28支持库,则可以删除。
androidx.core:core:1.5.0-alpha02
错误提示是因为androidx core和v28发生冲突。使用其中之一。而且androidx核心也具有与v7.AppCompatActivity相同的方法,所以为什么不使用
将其迁移到androidx import androidx.appcompat.app.AppCompatActivity