Dependency ignored because of conflict Android studio
You can exclude dependencies in the build.gradle file of your module.
compile('com.google.apis:google-api-services-drive:v2-rev170-1.20.0') {
exclude module: 'httpclient' //by artifact name
exclude group: 'org.apache.httpcomponents' //by group
exclude group: 'org.apache.httpcomponents', module: 'httpclient' //by both name and group
}
Android Studio reporting a dependency conflict for org.apache.httpcomponents:httpclient that I can't find
Yes, it's because google-api-services-drive
indirectly depends on httpclient
(google-api-services-drive
needs google-api-client
, which needs google-http-client-jackson2
and google-oauth-client
, which both need google-http-client
, which needs httpclient
).
There are instructions for viewing the dependency tree on another question: Using gradle to find dependency tree
Dependency is ignored for debug as it may be conflicting with internal version provided by android
Ended up making a simple http request to the twilio web service rather than using the dependency to make the request for me...worked perfect
Android Gradle Dependency conflict with internal version provided by Android
OK, Geadle is f*king horrible although is powerful tool.
For your reference if you fall in same trouble this is my experience. Since I'm not sure my findings are absolutely right please correct me if I'm wrong.
- I found that it is not possible to put your test folder under library projects. I wanted to have
src/test/java
for every project libraries and run my test cases like./gradlew :booking-sdk:test
. However, by moving this package to main application (in my casebooking-app
) and also moving related files from build.gradle ofbooking-sdk
to build.gradle ofbooking-app
I could see test case results. - I found
exclude
modules from dependencies don't work. The solution that I found is using configuration.
Like this:
configurations {
all*.exclude module: 'classworlds'
all*.exclude module: 'commons-logging'
all*.exclude module: 'httpclient'
all*.exclude module: 'maven-artifact'
all*.exclude module: 'maven-artifact-manager'
all*.exclude module: 'maven-error-diagnostics'
all*.exclude module: 'maven-model'
all*.exclude module: 'maven-project'
all*.exclude module: 'maven-settings'
all*.exclude module: 'plexus-container-default'
all*.exclude module: 'plexus-interpolation'
all*.exclude module: 'plexus-utils'
all*.exclude module: 'wagon-file'
all*.exclude module: 'wagon-http-lightweight'
all*.exclude module: 'wagon-provider-api'
}
Hope it helps.
SendGrid for android Dependency is ignored for release as it may be conflicting with the internal version provided by Android
The doc is clear and maybe you forget this:
Because the Library uses an updated version of Apache's Http Library we need to add the following packaging options so the APK gets built correctly, without libraries conflicting. This goes into your app's build.gradle.
...
android {
...
packagingOptions {
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
}
}
Edit
My app build.gradle
file:
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "com.hackerli.view"
minSdkVersion 16
targetSdkVersion 22
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
packagingOptions {
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.2.1'
compile 'com.github.danysantiago:sendgrid-android:1'
}
Related Topics
5.1 Crash - a Taskdescription's Primary Color Should Be Opaque
How to Use the Speechrecognizer API Directly for Speech Input
Using Webview Sethttpauthusernamepassword
Android Repeat Action on Pressing and Holding a Button
What Is the Android UI Thread Stack Size Limit and How to Overcome It
How to Download a PDF File in Android
Data Directory Has No Read/Write Permission in Android
Gradle Flavors for Android with Custom Source Sets - What Should the Gradle Files Look Like
How to Change Actionbar Tab Indicator Programmatically
How to Download a Video File to Sd Card
How to Download a File from a Server and Save It in Specific Folder in Sd Card in Android
Error When Using Any Android Design Support Library Elements
Android Volley Sending Data Twice
Android:Textallcaps="False" Not Working for Tablayout Design Support
How to Use Mediacodec Without Mediaextractor for H264