Gradle failed to sync with 'unable to find optional library'

前端 未结 9 2375
刺人心
刺人心 2020-12-01 18:24

I had to reinstall my system and today I get this error in Android Studio when I try to sync with gradle:

Warning: Unable to find optional library: org.apach         


        
相关标签:
9条回答
  • 2020-12-01 19:13
    1. Copy "sdk\platforms\android-23\optional\org.apache.http.legacy.jar" to your app module libs directory, then add as library;
    2. If you enable the proguard, please edit "proguard-rules.pro" to keep related classes or exception will occurred.
    0 讨论(0)
  • 2020-12-01 19:14

    To save time 2 solutions are best and works for me.

    Solution 1 :

    open your android sdk manager and reinstall API 23 (remove and install again).

    Solution 2 :

    Download this file which contain optional.json file extract and move optional.json to :

    C:\Users\\AppData\Local\Android\sdk\platforms\android-23\optional

    0 讨论(0)
  • 2020-12-01 19:15

    Update your project gradle file to use gradle version 1.3.1.

    classpath 'com.android.tools.build:gradle:1.3.1'
    

    Also try adding codehause repo.

    repositories {
            mavenCentral()
            maven{
                url 'http://repository.codehaus.org'
            }
        }
    
    0 讨论(0)
提交回复
热议问题