Dependencies添加recyclerview出现Manifest merger failed

环境:

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#android.support.VERSION@value 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。



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

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
As an AI language model, I do not have access to the logs of your specific project. However, I can provide you with some general solutions to fix the "Manifest merger failed" error: 1. Check for conflicting dependencies: The error can occur when there are conflicting dependencies in your project. Check the dependencies in your build.gradle file and make sure they are compatible with each other. 2. Use the correct version of Gradle: Make sure you are using the correct version of Gradle that is compatible with your project. You can check the required Gradle version in the documentation of the library or framework you are using. 3. Use the correct version of Android Studio: Make sure you are using the correct version of Android Studio that is compatible with your project. 4. Clean and rebuild your project: Sometimes, the error can be resolved by cleaning and rebuilding your project. Go to Build > Clean Project and Build > Rebuild Project. 5. Check for missing or duplicate resources: The error can also occur if there are missing or duplicate resources in your project. Check the resources folder and make sure there are no missing or duplicate files. 6. Add missing attributes to manifest: If the error is related to missing attributes in your manifest file, add them to the manifest file. 7. Use a third-party tool: If none of the above solutions work, you can use a third-party tool like "Manifest Merger" to automatically resolve the conflicts in your manifest file. Remember to always check the logs for more specific information about the error, and to make sure you are following the guidelines of the libraries and frameworks you are using.
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值