在gradle文件中为HTTP添加哪些依赖项ByteArrayBody, HttpMultipartMode, Stri



我在gradle文件中添加了以下内容

android {
compileSdkVersion 30
buildToolsVersion "30.0.2"
useLibrary  'org.apache.http.legacy'
useLibrary  'org.apache.http.entity.mime.content'
defaultConfig {
applicationId "com.example.swuljcityconductor"
minSdkVersion 24
targetSdkVersion 30
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}

我还添加了以下清单文件

<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.INTERNET" />

我想通过HTTP POst发送图像文件。我还需要做些什么吗?关键字ByteArrayBody, HttpMultipartMode, StringBody不能解析。我还需要补充什么吗?

Retrofit是android中最好的http,有一些缓存和更多的功能,你可以阅读https://square.github.io/retrofit/和https://github.com/square/retrofit

最新更新