Attribute application@appComponentFactory value=(android.support.v4.app.CoreComponentFactory) fro...

今天在集成那个二维码在build.gradle里面添加

implementation 'com.journeyapps:zxing-android-embedded:4.1.0'

implementation 'androidx.appcompat:appcompat:1.0.2'

在build的时候报错了(如下)

Error:F:\MyApplication\app\src\main\AndroidManifest.xml:22:18-91 Error:

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.1] AndroidManifest.xml:22:18-86 value=(androidx.core.app.CoreComponentFactory).

Suggestion: add 'tools:replace="android:appComponentFactory"' to <application> element at AndroidManifest.xml:66:5-149:19 to override.

FAILURE: Build failed with an exception.

* What went wrong:

Execution failed for task ':app:processDebugManifest'.

> Manifest merger failed with multiple errors, see logs

* Try:

Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 47s

经过尝试 在清单文件(manifest)里面的application里面添加下面俩句话


其中 

treplace="android:appComponentFactory"

android:appComponentFactory="任意字符串都行”

原因:这个配置是和依赖包的版本号有关,和Androidx有关,看博客上的说法是Androidx和Android support库不能共存的原因,具体的原因在报错中也有体现,gradle的版本升级到3.2.0之后估计都会遇到这样的问题,希望我遇到的问题能够帮助大家解决问题!(我的gradle版本是3.2.0)

©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

友情链接更多精彩内容