Lint Error: `httpclient` Defines Classes That Conflict With Classes Now Provided By Android
I am trying to update my app from the deprecated Android Drive API to the Drive REST API by following the sample app. When trying to build the signed release APK, I get this lint p
Solution 1:
Try excluding the org.apache.httpcomponents
module also from google-http-client-gson
.
Then, if your projects requires Apache HttpClient classes, use some wrapper to provide them, e.g. this one works great even when targetting the newest SDK.
I use the following block in app\build.gradle
and it works fine (I just use older version of google-http-client-gson
module):
compile ('com.google.http-client:google-http-client-gson:1.19.0') {
//Exclude conflicting modules
exclude module: 'httpclient'
exclude module: 'commons-logging'
}
//Add HttpClient classes from a different package
compile 'cz.msebera.android:httpclient:4.5.8'
Then you will just have to change all your org.apache.http
imports to cz.msebera.android.httpclient
, e.g.
import org.apache.http.HttpResponse
becomes
import cz.msebera.android.httpclient.HttpResponse
Post a Comment for "Lint Error: `httpclient` Defines Classes That Conflict With Classes Now Provided By Android"