如何將Apache HTTP API(舊版)作為編譯時依賴添加到Android M的build.grade?如前所述這里,Android的M將不支持的Apache HTTP API。文檔聲明:請改用HttpURLConnection類。要么要繼續使用Apache HTTP API,必須首先在build.gradle文件中聲明以下編譯時依賴項:android {useLibrary'org.apache.http.legacy'}我已經將我項目的大部分HttpClient用法轉換為HttpURLConnection,但是,我仍然需要在一些領域使用HttpClient。因此,我試圖將'org.apache.http.legacy'聲明為編譯時依賴項,但在build.gradle中出現錯誤:找不到Gradle DSL方法:'useLibrary()'我的問題是:如何在項目中將'org.apache.http.legacy'聲明為編譯時依賴項?任何幫助深表感謝。謝謝
3 回答

米琪卡哇伊
TA貢獻1998條經驗 獲得超6個贊
另一種選擇是只添加jbundle依賴。這對Android Studio更加友好,因為Android Studio沒有給出消息“無法解析符號......”
dependencies { compile 'org.jbundle.util.osgi.wrapped:org.jbundle.util.osgi.wrapped.org.apache.http.client:4.1.2' }
- 3 回答
- 0 關注
- 542 瀏覽
添加回答
舉報
0/150
提交
取消