Android支持v4 13.0.0&的Gradle依赖问题23.4.0

时间:2017-05-06 12:33:30

标签: java android gradle dependencies

您好我似乎无法在我的gradle中找到版本13.0.0。我还使用以下代码将其设置为23.4.0,但它不会改变任何内容。

感谢:

apply plugin: 'com.android.application'

android {
    buildTypes {
    compileSdkVersion 23
    buildToolsVersion '25.0.0'

    defaultConfig {
        applicationId "com.parse.starter"
        minSdkVersion rootProject.ext.minSdkVersion
        targetSdkVersion rootProject.ext.targetSdkVersion
        versionCode 1
        versionName "1.0"
        multiDexEnabled true
    }
        release {


            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
        /*dexOptions {
            javaMaxHeapSize "4g";;-


        }*/
}
    buildToolsVersion '25.0.0'
}



ext {

    supportLibraryVersion = '23.4.0'
    playServicesVersion = '3.2.65'
    boltVersion = '1.4.0'
}

subprojects {
    project.configurations.all {
        resolutionStrategy.eachDependency { details ->
            if (details.requested.jar == 'com.android.support'
                    && !details.requested.name.contains('multidex')) {
                details.useVersion "$supportLibraryVersion"
            }
            if (details.requested.jar == 'com.google.android.gms'){
                details.useVersion "playServicesVersion"
            }
            if (details.requested.jar == 'com.android.support:animated-vector-drawable'){

                details.useVersion "$supportLibraryVersion"

            }
            if (details.requested.jar == 'com.parse.bolts:bolts-tasks'){

                details.useVersion "$boltVersion"

            }


        }


    }
}

configurations.all {
    resolutionStrategy {
        // fail eagerly on version conflict (includes transitive dependencies)
        // e.g. multiple different versions of the same dependency (group and name are equal)
        failOnVersionConflict()

        // prefer modules that are part of this build (multi-project or composite build) over external modules
        preferProjectModules()


        dependencySubstitution {

            substitute module('com.android.support:animated-vector-drawable:23.4.0') with module('com.android.support:animated-vector-drawable:23.0.0')
            //substitute module('com.google.android.gms:play-services:3.2.65') with module('com.google.android.gms:play-services:9.4.0')
            substitute module('com.android.support:appcompat-v7:13.0.0') with module('com.android.support:appcompat-v7:23.4.0')
        }
    }}

dependencies {
    compile "com.android.support:appcompat-v7:$supportLibraryVersion"
    compile "com.google.android.gms:play-services:$playServicesVersion"
    compile "com.google.android.gms:play-services-maps:$playServicesVersion"
    compile "com.parse.bolts:bolts-tasks:$boltVersion"
    compile 'com.parse:parse-android:1.13.0'
    compile 'com.android.support:multidex:1.0.0'
    compile 'com.android.support.constraint:constraint-layout:1.0.2'
    compile 'com.google.maps.android:android-maps-utils:0.3'
    compile 'com.android.support:support-v4:13.0.0'

}

错误日志:以下模块之间发现冲突:   - com.android.support:support-v4:13.0.0   - com.android.support:support-v4:23.4.0

1 个答案:

答案 0 :(得分:0)

删除依赖项中的compile 'com.android.support:support-v4:13.0.0'。你有两个版本的support-v4神器。

dependencies {
    compile "com.android.support:appcompat-v7:$supportLibraryVersion"
    compile "com.google.android.gms:play-services:$playServicesVersion"
    compile "com.google.android.gms:play-services-maps:$playServicesVersion"
    compile "com.parse.bolts:bolts-tasks:$boltVersion"
    compile 'com.parse:parse-android:1.13.0'
    compile 'com.android.support:multidex:1.0.0'
    compile 'com.android.support.constraint:constraint-layout:1.0.2'
    compile 'com.google.maps.android:android-maps-utils:0.3'
    compile 'com.android.support:support-v4:13.0.0'  // <-- This is your version 13.1.0

}