본문 바로가기
옛날

android studio DefaultHttpClient, HttpClient import 에러

by 차가운게 조아 2016. 4. 5.




import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.impl.client.DefaultHttpClient;


위의 것들 에러


can not resolve symbol defaulthttpclient



HttpClient is not supported any more in sdk 23. You have to use URLConnection or downgrade to sdk 22 (compile 'com.android.support:appcompat-v7:22.2.0')

If you need sdk 23, add this to your gradle:

android {
    useLibrary 'org.apache.http.legacy'
}

You also may try to download and include HttpClient jar directly into your project or use OkHttpinstead



can not resolve symbol httpclient

Just add this in your dependencies

compile 'org.apache.httpcomponents:httpcore:4.4.1'
compile 'org.apache.httpcomponents:httpclient:4.5'

Finally

 dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])

testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.0.1'
compile 'com.android.support:design:23.0.1'
compile 'org.apache.httpcomponents:httpcore:4.4.1'
compile 'org.apache.httpcomponents:httpclient:4.5'
}

I hope it will helps you .






'옛날' 카테고리의 다른 글

javascript 변수  (0) 2016.04.20
Developer Console 사용하기  (0) 2016.04.20
맛도 크기도 다 마음에드는 청포도맛 사탕  (0) 2016.04.01
안드로이드 플랫폼 구조  (0) 2016.03.31
안드로이드 주요 용어  (0) 2016.03.31