NoClassDefFoundError: org.apache.http.entity.mime.content.StringBody
2014-09-26 11:24
567 查看
1.出错代码:StringBody strbType = new StringBody("123" , Charset.forName("UTF-8"));
2.问题描述:编译期间没问题,运行后报异常“NoClassDefFoundError: org.apache.http.entity.mime.content.StringBody”
3.问题原因1:如下图,libs1中的包编译时都OK,但该Android项目生成apk时,都没有被编进.dex,所以运行时缺失(原因后面说)。
解决方法A:全部放进libs中后,问题解决;
解决方法B:右键上述3.中libs1目录,点击build path--> use as source folder 即可;
解决方法C:点击面板“Order and Export”,勾选要导出的“entries”,选中下图红框中的jar包即可(所以,生成apk时丢掉的原因是这里要选中最后导出的"entry");
4.问题原因2:没有正确引用外部android工程。
解决方法:引用的外部工程应从上图的" Required projects "改为下图的" Library project "方式;
补充说明:至于Library project的概念,提供以下引文供参考
2.问题描述:编译期间没问题,运行后报异常“NoClassDefFoundError: org.apache.http.entity.mime.content.StringBody”
3.问题原因1:如下图,libs1中的包编译时都OK,但该Android项目生成apk时,都没有被编进.dex,所以运行时缺失(原因后面说)。
解决方法A:全部放进libs中后,问题解决;
解决方法B:右键上述3.中libs1目录,点击build path--> use as source folder 即可;
解决方法C:点击面板“Order and Export”,勾选要导出的“entries”,选中下图红框中的jar包即可(所以,生成apk时丢掉的原因是这里要选中最后导出的"entry");
4.问题原因2:没有正确引用外部android工程。
解决方法:引用的外部工程应从上图的" Required projects "改为下图的" Library project "方式;
补充说明:至于Library project的概念,提供以下引文供参考
the components, code and resources of the <span style="color:#ff0000;">library project </span>are compiled and packaged into the .apk file of the compiled application. An Android<span style="color:#ff0000;"> library project </span>can contain Java classes, Android components and resources. Only assets are not supported. The<span style="color:#ff0000;"> library project </span>must declare all its components, e.g., activities, service, etc. via the AndroidManifest.xml file. The application which uses the library must also declare all the used components via the AndroidManifest.xml file.
相关文章推荐
- java.lang.NoClassDefFoundError: org/apache/http/entity/mime/content/ContentBody
- android "Could not find class 'org.apache.http.entity.mime.content.FileBody" error
- maven中出现java.lang.ClassNotFoundException: org.apache.http.entity.mime.content.ContentBody
- com.android.dex.DexException: Multiple dex files define Lorg/apache/http/entity/mime/FormBodyPart;
- org.apache.http.client.methods.HttpPost 两种消息体形式 —— UrlEncodedFormEntity 和 StringEntity
- 友盟分享遇到Caused by: java.lang.ClassNotFoundException: Didn't find class "org.apache.http.entity.mime.Mu
- at org.apache.http.util.EntityUtils.toString(EntityUtils.java:244) 线程卡死
- 'org.apache.http.entity.mime.MultipartEntity',
- Could not find class 'org.apache.http.entity.mime.MultipartEntity'
- E/AndroidRuntime(22486): java.lang.NoClassDefFoundError: org.apache.http.entity.mime.MultipartEntity
- The type org.apache.http.HttpEntityEnclosingRequest cannot be resolved
- 使用AsyncHttpClient下载图片出现org.apache.http.client.HttpResponseException: Content-Type not allowed!
- Failed to read artifact descriptor for org.apache.httpcomponents:httpmime:jar
- 关于androidstuio运行程序遇到 Error:(11, 8) 错误: 无法访问HttpEntity 找不到org.apache.http.HttpEntity的类文件解决方法
- java.lang.NoClassDefFoundError: org/apache/commons/httpclient/methods/RequestEntity
- jeesite, 片云,发送短信,有jar包,但找不到ClassNotFoundException org.apache.http.HttpEntity
- 利用支付宝的团队编写的 HttpProtocolHandler 、StringRequestEntity 调用微信 支付引发的 body不是UTF8编码的
- Android Studio 编译不通过,报错“找不到org.apache.http.HttpEntity”
- The type org.apache.http.HttpEntity cannot be resolved.错误的解决
- solr异常:org.apache.solr.client.solrj.impl.HttpSolrServer$RemoteSolrException: Expected mime type appl