为什么警告:找不到可选库:org.apache.http.legacy? [英] Why Warning:Unable to find optional library: org.apache.http.legacy occurs?

查看:1275
本文介绍了为什么警告:找不到可选库:org.apache.http.legacy?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的gradle文件:

My gradle file:

apply plugin: 'com.android.application' 

android { 
  useLibrary 'org.apache.http.legacy' 
  compileSdkVersion 23 
  buildToolsVersion "23.0.0" 

  defaultConfig { 
    applicationId "com.skripsi.irwanto.paud" 
    minSdkVersion 15 
    targetSdkVersion 23 
    versionCode 1 
    versionName "1.0" 
  } 

  buildTypes { 
    release { 
      minifyEnabled false 
      proguardFiles getDefaultProauardFile('proguard-android.txt'), 'proguard-rules.pro' 
    } 
  } 
} 
dependencies { 
 compile fileTree(include: ['*.jar'], dir: 'libs') 
 testCompile 'junit:junit:4.12' 
 compile 'com.android.support:appcompat-v7:23.1.11 
} 

然后我得到Warning:Unable to find optional library: org.apache.http.legacy

推荐答案

我猜想,无需重新安装SDK即可更轻松地解决此问题的方法是在<sdk-path>\platforms\android-23\optional\目录中创建一个名为optional.json的文件,其中包含以下内容内容:

I guess, the easier way to solve this issue without having to reinstall the SDK is to create a file called optional.json in <sdk-path>\platforms\android-23\optional\ directory with the following content:

[
  {
    "name": "org.apache.http.legacy",
    "jar": "org.apache.http.legacy.jar",
    "manifest": false
  }
]

它为我解决了这个问题.

It solved the problem for me.

编辑:以下信息来自@domoch,有关如何找到您的SDK位置

EDIT: Information taken from @domoch's answer below on how to locate your SDK location

转到Android Studio Settings -> Appearence & Behavior -> System Settings并查找Android SDK Location.在Windows中,通常会指向C:\Users\<username>\AppData\Local\Android\sdk.

Go to Android Studio Settings -> Appearence & Behavior -> System Settings and look for Android SDK Location. In Windows, it usually would be pointing to C:\Users\<username>\AppData\Local\Android\sdk.

这篇关于为什么警告:找不到可选库:org.apache.http.legacy?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆