环境:

Android Studio Version: Android Studio 2.3.1

Compile Sdk Version: API 25: Android 7.1.1 (Nougat)

Build Tools Version: 25.0.2


  最近更新了Android Studio,其中support-v7更新到25.3.1,结果新建项目的时候导入RecyclerView后build gradle时候发生Manifest merger failed的错误。


Manifest merger failed : Attribute meta-data#[email protected] value=(25.3.1) from [com.android.support:appcompat-v7:25.3.1] AndroidManifest.xml:27:9-31 is also present at [com.android.support:recyclerview-v7:26.0.0-alpha1] AndroidManifest.xml:24:9-38 value=(26.0.0-alpha1). Suggestion: add 'tools:replace="android:value"' to element at AndroidManifest.xml:25:5-27:34 to override.


  大概意思是说两个包的版本信息有重复,Android Studio推荐的做法是在manifest的meta-data中插入'tools:replace="android:value"'。但是即使这么做,也会报以下错误:


Error:Execution failed for task ':app:processDebugManifest'.

Manifest merger failed with multiple errors, see logs


  在网上找了很多博文的没答案,后来我打开以前建立的项目,发现这个项目的recyclerview-v7版本也是26.0.0-alpha1,但是appcompat-v7的版本是23.4.0。于是我把新项目的appcompat版本更改为23.4.0,build gradle成功。


更新(2017-5-3)

  即使把appcompat-v7的版本改为23.4.0,继续使用recyclerview-v7:26.0.0-alpha1还是会出问题,在布局编辑器根本用不了RecyclerView,要把recyclerview-v7版本改为26.0.0-alpha1之前的,例如22.2.1。


Dependencies添加recyclerview出现Manifest merger failed

  今天又一轮更新后,appcompat-v7的版本也更新到26.0.0-alpha1,这样recyclerview-v7也用26.0.0-alpha1来build gradle就不会报Manifest merger failed,布局编辑器也能看到RecyclerView。暂时未了解两个support的版本之间的问题。

相关文章:

  • 2022-01-20
  • 2021-06-30
  • 2022-01-08
猜你喜欢
  • 2021-10-28
  • 2021-12-22
  • 2021-10-13
  • 2021-07-11
  • 2021-06-24
  • 2021-08-14
  • 2022-12-23
相关资源
相似解决方案