我的build.gradle
文件:
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:23.4.0'
compile 'com.google.android.gms:play-services-location:9.4.0'
compile 'com.android.support:design:23.4.0'
compile 'com.github.pwittchen:weathericonview:1.1.0'
compile 'com.jakewharton:butterknife:8.3.0'
compile 'com.android.support:support-v4:23.4.0'
testCompile 'junit:junit:4.12'
apt 'com.jakewharton:butterknife-compiler:8.3.0'
compile 'com.android.support.constraint:constraint-layout:1.0.0-beta4'
compile 'me.everything:overscroll-decor-android:1.0.3'
}
将此依赖项 'com.github.paolorotolo:appintro:4.1.0'
添加到 gradle 文件中将这部分标记为红线 'com.android.support:appcompat-v7:23.4.0 '
来 self 的 gradle 文件并给出以下错误:
All com.android.support libraries must the exact same specification. Found versions 24.2.1, 23.4.0
这是什么意思?添加该依赖项时如何避免这种冲突?
最佳答案
这意味着新的 appintro 依赖项添加了对支持库 v24.2.1 的子依赖项,但您已经有一个更早的版本。
将您的直接依赖项更新为相同版本,这在实践中可能没问题,否则您将需要使用较旧版本的 appintro,而后者又使用较早版本的支持库。
也就是说,在前者的情况下,将您的行更改为:
com.android.support:appcompat-v7:24.2.1
编辑:我说“可能很好”,因为 Android 支持库是一组非常稳定的 API,并且在各个版本中继续保持一致的性能。除此之外,通常在需要更改版本时,您需要评估是否存在任何重大更改或行为改变。
关于android - 向 Gradle 文件添加新依赖项时出错?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41228227/