Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

HttpClient not working in my android studio 1.4 [duplicate]

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\loginandsign\SimpleHttpClient.java

Error:(27, 20) error: cannot find symbol class HttpClient

Error:(34, 20) error: cannot find symbol class HttpClient

Error:(36, 31) error: cannot find symbol class DefaultHttpClient

Error:(40, 13) error: cannot find symbol variable ConnManagerParams


Error:(57, 13) error: cannot find symbol class HttpClient

Error:(58, 13) error: cannot find symbol class HttpPost

Error:(58, 36) error: cannot find symbol class HttpPost

Error:(59, 13) error: cannot find symbol class UrlEncodedFormEntity

Error:(59, 51) error: cannot find symbol class UrlEncodedFormEntity

Error:(96, 13) error: cannot find symbol class HttpClient

Error:(97, 13) error: cannot find symbol class HttpGet

Error:(97, 35) error: cannot find symbol class HttpGet

I added below dependency but still it showing same error

dependencies {
compile 'com.google.android.gms:play-services:+'
compile 'org.apache.httpcomponents:httpclient:4.2.6'
compile 'org.apache.httpcomponents:httpmime:4.2.6'
compile files('libs/core.jar')
}
like image 267
pramod K Avatar asked Jan 28 '16 05:01

pramod K


1 Answers

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 .

like image 68
IntelliJ Amiya Avatar answered Sep 28 '22 11:09

IntelliJ Amiya