Why Warning:Unable to find optional library: org.apache.http.legacy occurs?

前端 未结 5 1914
隐瞒了意图╮
隐瞒了意图╮ 2020-12-08 07:26

My gradle file:

apply plugin: \'com.android.application\' 

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


        
5条回答
  •  庸人自扰
    2020-12-08 07:55

    I guess, the easier way to solve this issue without having to reinstall the SDK is to create a file called optional.json in \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.


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

    To Locate your Android SDK's Location

    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\\AppData\Local\Android\sdk.

提交回复
热议问题