我在build.gradle文件中收到以下错误消息:
所有com.android.support库必须使用完全相同的版本规范(混合版本可能导致运行时崩溃)。找到的版本28.0.0,25.2.0。示例包括com.android.support:animated-vector-drawable:28.0.0和com.android.support:support-media-compat:25.2.0 less ...(Ctrl + F1)有一些库的组合,或者工具和库,不兼容,或可能导致错误。一个这样的不兼容性是使用不是最新版本的Android支持库版本(或者特别是低于targetSdkVersion的版本)进行编译。
下面是我的build.gradle文件的当前状态。但是,我看不到任何明确引用上述错误消息中提到的不同版本的依赖关系。
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
buildToolsVersion "28.0.3"
defaultConfig {
applicationId "com.parse.ideanetwork"
minSdkVersion 15
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
versionCode 5
vectorDrawables.useSupportLibrary = true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:28'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.android.support:design:28.0.0'
compile 'com.google.android.gms:play-services-ads:11.0.0'
compile "com.github.parse-community.Parse-SDK-Android:parse:1.18.5"
}
任何帮助深表感谢。谢谢。
使用最新版本明确声明最旧的版本依赖性似乎有效。我不认为这是更好的解决方案(也许它根本不是解决方案),但它忽略了警告。这就是我在做什么,现在没有任何破裂。
使用它,它将修复依赖版本不兼容问题。
configurations.all {
resolutionStrategy.eachDependency { DependencyResolveDetails details ->
def requested = details.requested
if (requested.group == 'com.android.support') {
// Skip multidex because it follows a different versioning pattern.
if (!requested.name.startsWith("multidex")) {
details.useVersion '28.0.0'
}
}
}
}