Jessica Pennell
Jessica Pennell

Reputation: 578

How do I fix the lint in android studio after allowing legacy code?

As we all are aware, Android removed support for org.apache.http after version 22. There is a switch in the app wide gradle build file which allows people to continue using it,

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.0"

    ...

    // enable org.apache.http
    useLibrary 'org.apache.http.legacy'
}

However, when I include code like

import org.apache.http.NameValuePair;

that still shows up underlined in red in android studio, despite compiling without errors. Everywhere I use NameValuePair also shows up in red. It makes it very difficult to sort legitimate errors from fake ones. In some of our source, which we can't afford to update yet, the entire right hand side of the screen next to the scrollbar is near solid red, all fake errors.

How do I correct this? It's really annoying.

EDIT: I'd like to add that the advice here, How to use the legacy Apache HTTP client on Android Marshmallow? , does not actually solve my problem. My problem is with Android studio's editor ; this is not an actual compile or runtime problem.

Upvotes: 1

Views: 314

Answers (1)

Rémi F
Rémi F

Reputation: 1335

This is an issue in Android Studio, which have not been released yet: Issue 183668: new useLibrary mechanism not supported in Studio

Upvotes: 1

Related Questions