[英]Android Support Library Gradle Conflict
I am having an issue regarding the inconsistent version of Android support libraries used in my app, but after specifying the exact same version in my Gradle I still get the same error. 我在我的应用程序中使用的Android支持库的不一致版本存在问题,但在我的Gradle中指定完全相同的版本后,我仍然得到相同的错误。
The problem is specifically between 'com.android.support:appcompat-v7:23.1.0'
and 'com.android.support:support-v4:24.0.0'
. 问题特别在
'com.android.support:appcompat-v7:23.1.0'
和'com.android.support:support-v4:24.0.0'
。 Even after specifying to compile 'com.android.support:support-v4:23.1.0'
it still says there is a conflict with support-v4:24.0.0
. 即使在指定
compile 'com.android.support:support-v4:23.1.0'
它仍然表示与support-v4:24.0.0
存在冲突。 Any help to resolve this issue will be greatly appreciated. 任何有助于解决此问题的帮助将不胜感激。
Edit: Below is my entire build.gradle file. 编辑:下面是我的整个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'
You need to check for the dependencies from the dependency tree with the following command in Linux : 您需要在Linux中使用以下命令检查依赖关系树中的依赖关系:
./gradlew app:dependencies
or if you're using Windows try this: 或者,如果您使用的是Windows,请尝试以下操作:
gradlew.bat app:dependencies
Then, after you found the dependency with support-v4:24.0.0
you can exclude it with: 然后,在使用
support-v4:24.0.0
找到依赖项后,可以使用以下命令将其排除:
compile('com.library.name:version') {
//exclude group: 'com.android.support'
//exclude module: 'support-v7'
//exclude module: 'appcompat-v7'
exclude module: 'support-v4'
}
Look at your android
DSL: 看看你的
android
DSL:
android {
compileSdkVersion 25
buildToolsVersion '25.0.2'
}
If buildToolsVersion
is 25+, so should compileSdkVersion
. 如果
buildToolsVersion
是25+,那么buildToolsVersion
也应compileSdkVersion
。
Since buildToolsVersion
is 25+, then your support libraries should be as well: 由于
buildToolsVersion
是25+,那么您的支持库也应该是这样的:
dependencies {
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support:support-v4:25.3.1'
compile 'com.android.support:design:25.3.1'
compile 'com.android.support:support-annotations:25.3.1'
}
In these situations when a library version is different from other versions, I suggest you add that library in your dependencies with the version equal to others. 在这些情况下,当库版本与其他版本不同时,我建议您在依赖项中添加该库,其版本与其他版本相同。
In your case, you can add all libraries with version 25.3.1
. 在您的情况下,您可以添加版本
25.3.1
所有库。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.