web-dev-qa-db-fra.com

Android: forcez Gradle à n'inclure qu'une seule version d'une bibliothèque

J'utilise 'com.Android.support:support-v4:23.3.0' dans mon build.gradle mais lorsque j'explore les bibliothèques externes, je vois deux versions de la bibliothèque support-v4 (23.3.0 & 24.0.0). Comment savoir quelle dépendance utilise la bibliothèque support-v4: 24.0.0? Comment puis-je forcer Gradle à ajouter uniquement la version 23.3.0?

external libraries image

voici ma liste de dépendances dans build.gradle:

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.Android.support:appcompat-v7:23.3.0'
    compile 'com.Android.support:support-v4:23.3.0'
    compile 'com.Android.support:design:23.3.0'
    compile 'com.Android.support:recyclerview-v7:23.3.0'
    compile 'com.Android.support:cardview-v7:23.3.0'
    compile ('com.nightonke:wowoviewpager:1.0.2') {
        exclude group: 'com.Android.support', module:'support-v4'
    }
    compile ('com.j256.ormlite:ormlite-Android:5.0'){
        exclude group: 'com.Android.support', module:'support-v4'
    }
    compile files('libs/picasso-2.5.2.jar')
    compile files('libs/easyandroidanimationslibrary-v0.5.jar')
    compile files('libs/Apache-httpcomponents-httpclient.jar')
    compile files('libs/Apache-httpcomponents-httpcore.jar')
    compile 'co.ronash.Android:pushe-base:1.2.0'
    compile 'com.google.Android.gms:play-services-gcm:9.4.0'
    compile('com.github.ozodrukh:CircularReveal:2.0.1@aar') {
        transitive = true;
    }
    compile files('libs/btsdk.jar')
    compile project(':zxing_barcode') // this project include the same version of support-v4 library
    compile project(':cropper')// this project include the same version of support-v4 library
    compile project(':taptargetview')// this project include the same version of support-v4 library
    compile ('me.cheshmak:analytics:1.0.28'){
        exclude group: 'com.Android.support', module:'support-v4'
    }
    compile 'com.github.siyamed:Android-shape-imageview:0.9.3@aar'
    compile ('com.github.rey5137:material:1.2.2'){
        exclude group: 'com.Android.support', module:'support-v4'
    }
    compile ('jp.wasabeef:recyclerview-animators:2.2.3'){
        exclude group: 'com.Android.support', module:'support-v4'
    }
    compile ('com.github.deano2390:MaterialShowcaseView:1.1.0@aar'){
        exclude group: 'com.Android.support', module:'support-v4'
    }
    compile 'org.greenrobot:eventbus:3.0.0'
    compile 'com.google.code.gson:gson:2.4'
    compile('com.crashlytics.sdk.Android:crashlytics:2.6.6@aar') {
        transitive = true;
    }
    compile('com.crashlytics.sdk.Android:answers:1.3.11@aar') {
        transitive = true;
    }

    compile ('cat.ereza:customactivityoncrash:1.5.0'){
        exclude group: 'com.Android.support', module:'support-v4'
    }
}

J'utilise exclude group: 'com.Android.support', module:'support-v4' pour éviter que d'autres ajoutent une bibliothèque de support mais aucun changement n'est survenu.

18
Mneckoee

Je ne peux pas ajouter de commentaire, je fais un lien ici:

https://stackoverflow.com/a/37357786/3442734

utilisation:

configurations.all { 
    resolutionStrategy.force 'com.Android.support:support-v4:24.0.0'
}
47
Wrobel