HttpClient won't import in Android Studio

后端 未结 23 2946
一生所求
一生所求 2020-11-22 14:44

I have a simple class written in Android Studio:

package com.mysite.myapp;

import org.apache.http.client.HttpClient;

public class Whatever {
    public voi         


        
23条回答
  •  情书的邮戳
    2020-11-22 15:27

    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 OkHttp instead

提交回复
热议问题