Reputation: 5524
I'm facing HttpClient dependency issue with Gradle 1.3.0 and Android Studio 1.3.2.
With the below gradle file, The following packages which are a part of Httpclient library are not being resolved
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.impl.client.DefaultHttpClient;
Gradle file
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.0"
defaultConfig {
applicationId "xxx.xxx.xxxx"
minSdkVersion 15
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:23.0.1'
compile ('org.apache.httpcomponents:httpcore:4.+') {
exclude module: 'httpclient'
}
compile 'org.apache.httpcomponents:httpclient:4.2.2'
}
The httpclient-4.2.2.jar has to be moved to the libs directory for the dependencies to be resolved, inspite of explicitly mentioned in gradle file.
Appreciate any help..
Upvotes: 0
Views: 6855
Reputation: 41
Just add this line in gradle:
compile 'org.jbundle.util.osgi.wrapped:org.jbundle.util.osgi.wrapped.org.apache.http.client:4.1.2'
Upvotes: 0
Reputation: 488
Take a look at the docs on behavior changes in Android M. Based on the docs you need to specify
android {
useLibrary 'org.apache.http.legacy'
}
in your gradle script to use Apache HttpClient if you compile with API 23.
Upvotes: 2
Reputation: 1670
I think the httpclient library doesn't include the mime parts, those are in httpmime. This is a transitive dependency of httpclient,
Try adding this dependency:
compile "org.apache.httpcomponents:httpmime:4.2.3"
Upvotes: 0