Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/183.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/extjs/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android支持库渐变冲突_Android_Android Gradle Plugin_Android Support Library - Fatal编程技术网

Android支持库渐变冲突

Android支持库渐变冲突,android,android-gradle-plugin,android-support-library,Android,Android Gradle Plugin,Android Support Library,我的应用程序中使用的Android支持库版本不一致,对此我有一个问题,但在Gradle中指定了完全相同的版本后,我仍然会收到相同的错误 问题具体存在于'com.android.support:appcompat-v7:23.1.0'和'com.android.support:support-v4:24.0.0'之间。即使指定编译'com.android.support:support-v4:23.1.0'后,它仍然表示与support-v4:24.0.0存在冲突。我们将非常感谢您为解决此问题提供

我的应用程序中使用的Android支持库版本不一致,对此我有一个问题,但在Gradle中指定了完全相同的版本后,我仍然会收到相同的错误

问题具体存在于
'com.android.support:appcompat-v7:23.1.0'
'com.android.support:support-v4:24.0.0'
之间。即使指定编译'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'

看看你的
android
DSL:

android {
    compileSdkVersion 25
    buildToolsVersion '25.0.2'
}
如果
buildToolsVersion
是25+,那么
compileSdkVersion
也应该是25+

既然
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'
}

您需要在Linux中使用以下命令从依赖关系树中检查依赖关系:

./gradlew app:dependencies
或者,如果您正在使用Windows,请尝试以下操作:

gradlew.bat app:dependencies
然后,在使用
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'
}

在这些情况下,当库版本与其他版本不同时,我建议您在依赖项中添加该库,使其版本与其他版本相同。


在您的情况下,您可以添加版本为
25.3.1

的所有库。请发布应用程序的build.gradle文件module@AbhishekAryanDone您的一个或多个可传递依赖项正在请求您自己未直接请求的Android支持库的某个部分的
24.0.0
,导致此冲突。您将需要运行Gradle依赖项报告并找出问题的原因,然后使用所需的版本手动请求这些工件(目前,
23.1.0
)。请注意,您可能会破坏这些依赖关系,因为它们期望更新(
24.0.0
23.1.0
更新)。啊,我明白了。为了避免打破这些依赖关系,我可以安全地忽略版本冲突警告,对吗?@ MyRoSs2考虑投票并接受帮助你的一个答案。谢谢,你救了我们的一天……最后一个解决方案很有效