我在我的应用中遇到了关于Android支持库版本不一致的问题,但是即使在Gradle中指定了完全相同的版本,我仍然会得到同样的错误。
问题出现在 'com.android.support:appcompat-v7:23.1.0' 和 'com.android.support:support-v4:24.0.0' 之间。即使指定了 'compile 'com.android.support:support-v4:23.1.0'',它仍然说与 'support-v4:24.0.0' 存在冲突。如果能够提供任何帮助解决这个问题,将不胜感激。
问题出现在 'com.android.support:appcompat-v7:23.1.0' 和 'com.android.support:support-v4:24.0.0' 之间。即使指定了 'compile 'com.android.support:support-v4:23.1.0'',它仍然说与 'support-v4:24.0.0' 存在冲突。如果能够提供任何帮助解决这个问题,将不胜感激。
编辑:以下是我的完整 build.gradle 文件。
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'io.fabric.tools:gradle:1.+'
}
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
repositories {
maven { url 'https://maven.fabric.io/public' }
}
def keystorePropertiesFile = rootProject.file("keystore.properties");
def keystoreProperties = new Properties()
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
android {
signingConfigs {
config {
keyAlias keystoreProperties['keyAlias']
keyPassword keystoreProperties['keyPassword']
storeFile file(keystoreProperties['storeFile'])
storePassword keystoreProperties['storePassword']
}
}
compileSdkVersion 23
buildToolsVersion '25.0.2'
defaultConfig {
applicationId "com.company"
minSdkVersion 16
targetSdkVersion 23
versionCode 48
versionName "5.1.5"
multiDexEnabled true
}
buildTypes {
release {
debuggable false
minifyEnabled true
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.config
}
}
packagingOptions {
exclude 'META-INF/LICENSE'
exclude 'META-INF/DEPENDENCIES'
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.1.0'
compile 'com.android.support:support-v4:23.1.0'
compile 'com.android.support:design:23.1.0'
compile 'com.android.support:support-annotations:23.1.0'
compile 'com.parse.bolts:bolts-android:1.4.0'
compile files('libs/Parse-1.13.0/Parse-1.13.0.jar')
compile 'com.pkmmte.view:circularimageview:1.1'
compile 'com.google.code.gson:gson:2.7'
// SugarORM
compile 'com.github.satyan:sugar:1.5'
compile 'com.android.support:multidex:1.0.1'
// Firebase
compile 'com.google.firebase:firebase-core:10.2.0'
compile 'com.google.firebase:firebase-messaging:10.2.0'
// Google play services
compile 'com.google.android.gms:play-services-location:10.2.0'
compile 'com.google.android.gms:play-services-places:10.2.0'
// Timber logging
compile 'com.jakewharton.timber:timber:4.5.0'
compile 'joda-time:joda-time:2.9.7'
// Crashlytics
compile('com.crashlytics.sdk.android:crashlytics:2.6.7@aar') {
transitive = true;
}
}
apply plugin: 'com.google.gms.google-services'
24.0.0
版本,而你自己并没有直接请求,导致了这个冲突。你需要运行 Gradle 依赖报告并找出是什么原因导致了这个问题,然后手动使用你想要的版本(目前为23.1.0
)请求这些构件。请注意,你可能会破坏那些依赖关系,因为它们期望得到更新的版本(24.0.0
比23.1.0
更新)。 - CommonsWare