• 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'//默认使用
                }
            }
        }
    }
  • 相关阅读:
    The 2019 China Collegiate Programming Contest Harbin Site A
    牛客练习赛15
    Wannafly挑战赛13-C
    Wannafly挑战赛13-D
    Subsequence Counting
    Minimize the error
    Educational Codeforces Round 42 (Rated for Div. 2)
    K-th Number
    Wannafly挑战赛13-E
    Minimum spanning tree for each edge
  • 原文地址:https://www.cnblogs.com/lwx521/p/9619211.html
Copyright © 2020-2023  润新知