Skip to content Skip to sidebar Skip to footer

Httpclient Not Working In My Android Studio 1.4

First sorry for my bad English I am new to android studio 1.4 ,I am getting error in HttpClient Error C:\Users\madhu\AndroidStudioProjects\LoginAndsign\app\src\main\java\com\login

Solution 1:

You need to initialize useLibrary 'org.apache.http.legacy'

Please check HttpClient won't import in Android Studio

android {
    compileSdkVersion 23
    buildToolsVersion '23.0.1' 


    defaultConfig {
        minSdkVersion // set yours 
        targetSdkVersion 23
        versionCode 11 //Yours
        versionName "0.1" // Yours
    }

dependencies {
compile'com.google.android.gms:play-services:7.8.0'compile'org.apache.httpcomponents:httpmime:4.2.6'compile'org.apache.httpcomponents:httpclient:4.5'compile files('libs/core.jar')
}

Then Clean-Rebuild-Restart-Sync Your Project .

Solution 2:

HttpClient was removed in Android 6.0.

To continue using HttpClient, add code below to your build.gradle:

 android{
    compileSdkVersion 23
    buildToolsVersion '23.0.1'
    useLibrary  'org.apache.http.legacy'
}

Solution 3:

Just add this line in dependencies

compile'org.jbundle.util.osgi.wrapped:org.jbundle.util.osgi.wrapped.org.apache.http.client:4.1.2'

Solution 4:

might be you didn't upgrade your gradle plugin in root build.gradle file.

dependencies {
        classpath 'com.android.tools.build:gradle:1.5.0'// Lowest version for useLibrary is 1.3.0// Android Studio will notify you about the latest stable version// See all versions: http://jcenter.bintray.com/com/android/tools/build/gradle/
    }

Solution 5:

if you are using target sdk as 23 add below code in your build.grade Module specific build.gradle - /app/build.gradle

android {
    compileSdkVersion 23
     buildToolsVersion "23.0.0"
     useLibrary 'org.apache.http.legacy'
     ...
       }

and change your buildscript to
**Top level build.gradle - /build.gradle**

   buildscript {
...
dependencies {
    classpath 'com.android.tools.build:gradle:1.3.1'
}
}

For More Information please check this android dev link

Post a Comment for "Httpclient Not Working In My Android Studio 1.4"