Skip to content

Instantly share code, notes, and snippets.

@krazykira
Last active May 26, 2016 16:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save krazykira/d3573e1877d938d55026ba87dca06372 to your computer and use it in GitHub Desktop.
Save krazykira/d3573e1877d938d55026ba87dca06372 to your computer and use it in GitHub Desktop.
This gist explains how you can remove a particular transitive dependency from your project
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "experiment.rx.directoryapi"
minSdkVersion 11
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'),
'proguard-rules.pro'
}
}
}
//If i do this it works but in this way support-annotations get removes from the project completely and i don't want that, use app:dependencies to test this
configurations {
// all*.exclude group: 'com.android.support', module:'support-annotations'
}
// exclude `support-annotation` from all the dependencies that contain`support-v4` as transitive dependency.
//or
// exclude `support-annotation` only from my `support-v4` dependency and remove `support-v4` dependency from all other dependencies that have `support-v4` as transitive dependency.
dependencies {
compile("com.android.support:support-v4:23.4.0") {
exclude group: 'com.android.support', module: 'support-annotations'
}
compile("com.facebook.fresco:fresco:0.9.0") {
//No other library references imagepipeline-base so we can go ahead and exclude it once and these changes will be reflected in app:dependencies
exclude group: 'com.facebook.fresco', module: 'imagepipeline-base'
exclude group: 'com.android.support', module: 'support-v4'
}
compile('com.android.support:appcompat-v7:23.4.0') {
exclude group: 'com.android.support', module: 'support-v4'
}
compile('com.google.android.gms:play-services-auth:9.0.0') {
exclude group: 'com.android.support', module: 'support-v4'
}
compile('com.google.android.gms:play-services-identity:9.0.0') {
exclude group: 'com.android.support', module: 'support-v4'
}
compile('pub.devrel:easypermissions:0.1.5') {
exclude group: 'com.android.support', module: 'support-v4'
}
compile('com.google.api-client:google-api-client-android:1+') {
exclude group: 'org.apache.httpcomponents'
}
compile('com.google.apis:google-api-services-admin-directory:directory_v1-rev53-1+') {
exclude group: 'org.apache.httpcomponents'
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment