org.apache.http不能引用的问题,解决方式
类里提示爆红
import org.apache.http.Header; import org.apache.http.HeaderElement; import org.apache.http.HttpEntity; import org.apache.http.HttpRequest; import org.apache.http.HttpRequestInterceptor; import org.apache.http.HttpResponse; import org.apache.http.HttpResponseInterceptor; import org.apache.http.HttpVersion;
有下面的错误提示
报错: Error:(19, 23) 错误: 程序包org.apache.http不存在 Error:(20, 23) 错误: 程序包org.apache.http不存在 Error:(21, 23) 错误: 程序包org.apache.http不存在 Error:(22, 30) 错误: 程序包org.apache.http.client不存在 Error:(23, 38) 错误: 程序包org.apache.http.client.methods不存在 Error:(24, 35) 错误: 程序包org.apache.http.impl.client不存在 Error:(175, 9) 错误: 找不到符号 符号: 类 HttpClient 位置: 类 SimpleWikiHelper Error:(175, 33) 错误: 找不到符号 符号: 类 DefaultHttpClient 位置: 类 SimpleWikiHelper Error:(176, 9) 错误: 找不到符号 符号: 类 HttpGet 位置: 类 SimpleWikiHelper Error:(176, 31) 错误: 找不到符号 符号: 类 HttpGet 位置: 类 SimpleWikiHelper Error:(180, 13) 错误: 找不到符号 符号: 类 HttpResponse 位置: 类 SimpleWikiHelper Error:(183, 13) 错误: 找不到符号 符号: 类 StatusLine 位置: 类 SimpleWikiHelper Error:(190, 13) 错误: 找不到符号 符号: 类 HttpEntity 位置: 类 SimpleWikiHelper
解决方法:
build.gradle中 在buildToolsVersion下边 defaultConfig上边
添加如下代码
useLibraryorg.apache.http.legacy
下一篇:
编写shell脚本自动启停jar包服务