HttpClient won't import in Android Studio

后端 未结 23 2481
一生所求
一生所求 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:31

    To use Apache HTTP for SDK Level 23:

    Top level build.gradle - /build.gradle

    buildscript {
        ...
        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/
        }
        ...
    }
    

    Notification from Android studio about gradle update:

    Module specific build.gradle - /app/build.gradle

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

提交回复
热议问题