EncodingUtils 报错Cannot Resolve Symbol EncodingUtils   提示是:错误:程序包org.apache.http.util不存在 错误:找不到符号  符号:变量 EncodingUtils

 

解决办法

EncodingUtils是 HttpCore里面的,你的build.gradle里面没有依赖这个包,解决办法是在build.gradle文件里面的依赖关系里面填写下面这一句话,并sync Now即可 :


compile 'org.apache.httpcomponents:httpcore:4.4.4‘

 步骤

1,打开android studion 中项目的Project项目目录找到app目录下的build.gradle打开并添加compile 'org.apache.httpcomponents:httpcore:4.4.4‘,

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.android.support:design:23.1.1'
compile 'org.apache.httpcomponents:httpcore:4.4.4'
}

2,转到项目类中导入

import org.apache.http.util.EncodingUtils;

3 gradle会提示你有变化,让你sync now 或者 sync again,点击 sync Now 一下即可

相关文章:

  • 2021-10-18
  • 2021-08-26
  • 2021-09-01
  • 2021-09-15
  • 2021-07-20
  • 2022-01-29
  • 2021-07-16
  • 2022-12-23
猜你喜欢
  • 2021-04-07
  • 2022-12-23
  • 2021-06-21
  • 2021-05-19
  • 2021-06-25
  • 2021-06-04
  • 2022-12-23
相关资源
相似解决方案