Android dependency 'com.android.support:support-v4' has different version for the compile (23.4.0) a

晁砚
2023-12-01

> Android dependency 'com.android.support:support-v4' has different version for the compile (23.4.0) and runtime (27.1.0) classpath. You should manually set the same version via DependencyResolution

Android dependency 'com.android.support:support-support-v4' has different version for the compile (23.1.1) and runtime (27.1.0) classpath. You should manually set the same version via DependencyResolution.
  • 1

这是引用了不同版本的v4包造成的。 
如果知道是哪个,一般用下面这个方法就可以

implementation("XXXXX") {
    exclude group: 'com.android.support', module: 'support-compat'
}
  • 1
  • 2
  • 3

如果实在是不知道哪个Library引用的,可以用下面这个方法,放在project 的build.gradle 下

subprojects {
    project.configurations.all {
        resolutionStrategy.eachDependency { details ->
            if (details.requested.group == 'com.android.support'
                    && !details.requested.name.contains('multidex') ) {
                details.useVersion '27.1.0'//改这个版本号到你想要的版本
            }
        }
    }
}
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10

具体位置示例

buildscript {

    dependencies {

    }
}
allprojects {
    repositories {
        jcenter()
        maven { url "https://jitpack.io" }
        mavenCentral()
        maven { url 'https://maven.google.com' }
        google()
    }
}
subprojects {
    project.configurations.all {
        resolutionStrategy.eachDependency { details ->
            if (details.requested.group == 'com.android.support'
                    && !details.requested.name.contains('multidex') ) {
                details.useVersion '27.1.0'
            }
        }
    }
}
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
转载。 https://blog.csdn.net/z19980115/article/details/79805144

 类似资料: