android httpclient gradle,Apache HttpClient Android (Gradle)
问题
I have added this line to my build.gradle
compile group: 'org.apache.httpcomponents' , name: 'httpclient-android' , version: '4.3.5'
and I want to use MultipartEntityBuilder in my code. However Android studio doesn't add the library to my code.
Can anyone help me with this?
回答1:
if you are using target sdk as 23 add below code in your build.gradle
android{
useLibrary 'org.apache.http.legacy'
}
additional note here: dont try using the gradle versions of those files. they are broken (28.08.15). I tried over 5 hours to get it to work. it just doesnt.
not working:
compile 'org.apache.httpcomponents:httpcore:4.4.1'
compile 'org.apache.httpcomponents:httpclient:4.5'
another thing dont use:
'org.apache.httpcomponents:httpclient-android:4.3.5.1'
its referring 21 api level.
回答2:
The accepted answer does not seem quite right to me. There is no point dragging a different version of HttpMime when one can depend on the same version of it.
compile group: 'org.apache.httpcomponents' , name: 'httpclient-android' , version: '4.3.5'
compile (group: 'org.apache.httpcomponents' , name: 'httpmime' , version: '4.3.5') {
exclude module: 'org.apache.httpcomponents:httpclient'
}
回答3:
Try adding this to your dependencies:
compile 'org.apache.httpcomponents:httpclient:4.4-alpha1'
And generally if you want to use a library and you are searching for the Gradle dependency line you can use Gradle Please
EDIT: Check this one too.
回答4:
None of the others worked for me. I had to add the following dependency, as explained here
compile group: 'cz.msebera.android' , name: 'httpclient', version: '4.4.1.1'
because I was targeting API 23.
回答5:
I resolved problem by adding following to my build.gradle file
android {
useLibrary 'org.apache.http.legacy'}
However this only works if you are using gradle 1.3.0-beta2 or greater, so you will have to add this to buildscript dependencies if you are on a lower version:
classpath 'com.android.tools.build:gradle:1.3.0-beta2'
回答6:
I searched over and over this solution works like a charm ::
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "25.0.3"
defaultConfig {
applicationId "com.anzma.memories"
useLibrary 'org.apache.http.legacy'
minSdkVersion 15
targetSdkVersion 25
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
packagingOptions {
exclude 'META-INF/DEPENDENCIES.txt'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/notice.txt'
exclude 'META-INF/license.txt'
exclude 'META-INF/dependencies.txt'
exclude 'META-INF/LGPL2.1'
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile('org.apache.httpcomponents:httpmime:4.3.6') {
exclude module: 'httpclient'
}
compile 'org.apache.httpcomponents:httpclient-android:4.3.5'
compile 'com.android.support:appcompat-v7:25.3.1'
testCompile 'junit:junit:4.12'
}
回答7:
I don't know why but (for now) httpclient can be compiled only as a jar into the libs directory in your project.
HttpCore works fine when it is included from mvn like that:
dependencies {
compile 'org.apache.httpcomponents:httpcore:4.4.3'
}
回答8:
Working gradle dependency
Try this:
compile 'org.jbundle.util.osgi.wrapped:org.jbundle.util.osgi.wrapped.org.apache.http.client:4.1.2'
来源:https://stackoverflow.com/questions/26024908/apache-httpclient-android-gradle
android httpclient gradle,Apache HttpClient Android (Gradle)相关推荐
- android httpclient gradle,Apache HttpClient Android(Gradle)
Apache HttpClient Android(Gradle) 我已经将此行添加到我的build.gradle compile group: 'org.apache.httpcomponents' ...
- Apache HttpClient
文章目录 Apache HttpClient 简介 Apache HttpClient特性 使用流程 使用实例 -END- Apache HttpClient 简介 HttpClient 是 Apac ...
- android studio 引入httpclient,HttpClient不会导入Android Studio
我有一个用Android Studio编写的简单类: package com.mysite.myapp; import org.apache.http.client.HttpClient; publi ...
- Android 6.0 以及HttpClient
Android 6.0 SDK,API Level 是 23.更新之后,就可以修改 compileSdkVersion 和targetSdkVersion 到 23 体验新的特性了. 同时 Andro ...
- Android 系统(198)---Android解放双手之Gradle自动化打包实战
Android解放双手之Gradle自动化打包实战 https://www.jianshu.com/u/0111a7da544b 前言 解放双手,双击桌面快捷方式生成apk包,基于Gradle.bat ...
- Android Studio 中的 gradle 介绍及build.gradle配置文件详解
不同于 Eclispse,Android Studio 是采用 Gradle 来构建项目的,Gradle 是一个非常先进强大的项目构建工具,它使用了一种基于 Groovy 领域的特定语言(DSL)来声 ...
- Android AOP编程(五)——Gradle插件+TransformAPI+字节码插桩实战
开篇 在前面几篇博文中,我记录了Android AOP编程的一些基础知识,包括Gradle插件的开发.TransformAPI的使用,以及一些操作字节码的工具如AspectJ,Javassist和AS ...
- Android Http请求网络HttpClient和HttpUrlConnection
在Android API Level 9(Android 2.2)之前只能使用DefaultHttpClient类发送http请求.DefaultHttpClient是Apache用于发送http请求 ...
- android学习笔记之HttpClient
HttpClient是Apache提供的HTTP网络访问接口,很早就被引入到了Android API中.它可以完成和HttpURLConnection几乎相同的效果,但两者之间的用法却有较大的差别. ...
- Gradle version 和 Android Plugin Version
常跟 Android Studio 打交道,应该对 Gradle version 和 Android Plugin Version 不陌生,Gradle version 和 Android Plugi ...
最新文章
- 兼容ie8 rgba()用法
- 互联网分布式微服务云平台规划分析--服务监控中心
- vtk读取文件并显示的几种方法
- Nginx的初步安装
- android 模仿微信布局,【Android初学者】框架布局:仿微信页面制作
- Ubuntu 通过apt安装VSCode
- Android工程重新编译问题
- WORD里边替换所有中文
- python求解偏微分方程_Python数值计算----------求解简单的偏微分方程
- installanywhere打包过程(openproj版)
- 算法分析怎么写_区位分析怎么写
- web大学生个人网站作业模板---钢铁侠电影下拉音乐滚字表单三级(9页)
- 自己的服务器进不去显示403,HTTP 403错误:含义和解决方法
- 1.5 人工智能迅速发展的技术领域
- html5对锚的更改,HTML5之锚链接
- SDN:mininet交换机流表操作
- 充分利用公网 -- 将联通光猫设置为桥接
- Spring源码学习(三)-- 底层架构核心概念解析
- VCS makefile文件
- 蒙特卡罗MCNP学习汇总(五)---高级几何建模
热门文章
- 引用echar显示图形
- Rhino导入Revit生成体量幕墙的方法和操作要点
- eclipse如何用php,phpeclipse使用详解
- 我是全网最硬核的高并发编程作者,CSDN最值得关注的博主,大家同意吗?(建议收藏)
- java考试系统倒计时的实现_(Java程序设计)第11章设计考试系统中的倒计时.ppt
- 孙玄:微服务架构何去何从?
- 支付宝APP支付 错误代码 insufficient-isv-permissions 错误原因: ISV权限不足
- C语言计算高精度圆周率pi程序的代码
- 【通信原理 入坑之路】基于MATLAB的移动通信系统仿真 之 瑞利衰落信道的原理与仿真
- 74hc138译码器实验c语言程序,基于74hc138译码器实验分析 详解74hc138译码器实验