[2016-08-05 10:23:09 - Dex Loader] Unable to execute dex: Multiple dex files define Lorg/apache/http/HttpConnection;
[2016-08-05 10:23:09 - Inspectionss] Conversion to Dalvik format failed: Unable to execute dex: Multiple dex files define Lorg/apache/http/HttpConnection;
出现了以上问题,这是我在导入org.apache.http.legacy.jar后出现的问题。前提是我根本没用过HttpConnection啊,怎么出现这样的错,网上查一直说重复架包,但不可能啊
android 6.0 抛弃了原有的httpClient 你不光得去引 jar 还得去buid里面去配一个
android {
useLibrary 'org.apache.http.legacy'
}
在吧下面那个放在gradle中就好了
你看下你创建的工程使用的库是哪个版本的,6.0的吗
Multiple dex files define Lorg/apache/http/HttpConnection; 这个估计是要clean 一下工程, 或者rebuild一下。
eclipse上不支持6.0吧?
在android studio上处理org.apache.http问题:
build.gradle上写上:
1.添加新的tools:
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.3.0'
}
}
2.添加引用包
android {
useLibrary 'org.apache.http.legacy'
}
stackOverFlow(处理方式):http://stackoverflow.com/questions/32340629/cant-import-org-apache-http-httpresponse-in-android-studio
你不会是吧Studio上的 项目移到 eclipse 了吧
Android6.0之后已经放弃HttpClient了,既然放弃了就有它的道理,应该主要是性能问题吧,你可以使用OKHttp3,也可以使用Retrofit这些高效的网络访问框架