zoukankan      html  css  js  c++  java
  • Attribute meta-data#android.support.VERSION@value value=(25.4.0) from AndroidManifest.xml:25:13-35 is also present at AndroidManifest.xml:28:13-35 value=(26.1.0).

    Android Studio 编译项目的时候报错

    Merging Errors:
    Error: Attribute meta-data#android.support.VERSION@value value=(25.4.0) from AndroidManifest.xml:25:13-35 is also present 
           at AndroidManifest.xml:28:13-35 value=(26.1.0). Suggestion: add 'tools:replace="android:value"' to <meta-data> element at 
           AndroidManifest.xml:23:9-25:38 to override. app main manifest (this file), line 24 

    原因是:程序内出现不同的,support或者其他外部引用库的多个版本,Gradle在进行合并的时候会使用本地持有的,最高版本的来进行编译,

                所以25的support就有可能引用26的东西,就会出现 属性 merge 错误 ,或者Class丢失,官方的解决方法是:

                在AndroidManifest.xml:中 加入tools:replace="android:value" 到 <meta-data>

                然而没看懂什么意思,最后找到了一种方法:

                在app的build.gradle中加入下面代码,强制指定一种版本

    configurations.all {
        resolutionStrategy.eachDependency { DependencyResolveDetails details ->
            def requested = details.requested
            if (requested.group == 'com.android.support') {
                if (!requested.name.startsWith("multidex")) {
                    details.useVersion '25.4.0'//默认使用
                }
            }
        }
    }
  • 相关阅读:
    nginx 安装ab小工具方法
    ab小工具的Failed requests多的问题
    linux webbench测试高并发方法
    html5 video获取实时播放进度的方法
    html5 video获取实时播放进度的方法
    下载网站上的视频的方法
    带宽的深入理解
    redis 清除minerd进程的方法
    php 500报错解决方案
    GIT和SVN之间的五个基本区别
  • 原文地址:https://www.cnblogs.com/lwx521/p/9619211.html
Copyright © 2011-2022 走看看