欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

android import org.apache.http.NameValuePair 错误问题

程序员文章站 2024-01-09 20:08:22
修改 build.gradle(Module:app) 文件,添加以下代码android { useLibrary 'org.apache.http.legacy'}dependencies { implementation 'org.apache.httpcomponents:httpcore:4.4.1'}完整build.gradle(Module:app) 文件,如下所示apply plugin: 'com.android.applica......
  • 修改 build.gradle(Module:app) 文件,添加以下代码
  1. android {
        useLibrary 'org.apache.http.legacy'
    }
  2. dependencies {    
        implementation 'org.apache.httpcomponents:httpcore:4.4.1'
    }
  • 完整 build.gradle(Module:app)  文件,如下所示
apply plugin: 'com.android.application'

android {
    compileSdkVersion 29
    buildToolsVersion "29.0.3"

    defaultConfig {
        applicationId "com.example.arioliu"
        minSdkVersion 23
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"

        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }

    useLibrary 'org.apache.http.legacy'
}


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

    implementation 'androidx.appcompat:appcompat:1.1.0'
    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'androidx.test.ext:junit:1.1.1'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
    implementation 'org.apache.httpcomponents:httpcore:4.4.1'
}

 

本文地址:https://blog.csdn.net/MoDa_Li/article/details/107185334