我正在使用 leakcanary 1.6.3
在我的项目中使用以下方法毫无问题地查找内存泄漏:
debugImplementation 'com.squareup.leakcanary:leakcanary-android:1.6.3'
现在我想将它更新为 leakcanary 2.0 alpha 2
使用:
debugImplementation 'com.squareup.leakcanary:leakcanary-android:2.0-alpha-2
但是当我尝试构建项目时,它给我 manifest merger failed
。
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.1] AndroidManifest.xml:22:18-86 value=(androidx.core.app.CoreComponentFactory).
Suggestion: add 'tools:replace="android:appComponentFactory"' to <application> element at AndroidManifest.xml:10:5-50:19 to override.
如何修复此错误?
更新:我正在我的项目中使用 android.support
库。
最佳答案
在对 leakcanary 2.0 alpha 2
代码进行一些研究后,我发现新版本的库使用了 androidx
库,但我使用的是 android.support
库在我的项目中。如果我重构我的项目以使用 androidx
则不会发生错误。
似乎是:
- 使用
androidx
的项目可以使用使用android.support
的库 - 但是使用
android.support
的项目不能使用使用androidx
的库
This所以回答解释 androidx
以及如何将您的项目迁移到 androidx
。
关于android - 使用 leakcanary 2.0 alpha 2 时 list 合并失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56290065/