gpt4 book ai didi

android - 允许遗留代码后如何修复 android studio 中的 lint?

转载 作者:行者123 更新时间:2023-11-30 01:54:28 25 4
gpt4 key购买 nike

众所周知,Android 在版本 22 之后删除了对 org.apache.http 的支持。应用范围的 gradle 构建文件中有一个开关允许人们继续使用它,

android {
compileSdkVersion 23
buildToolsVersion "23.0.0"

...

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

但是,当我包含如下代码时

import org.apache.http.NameValuePair;

尽管编译没有错误,但在 android studio 中仍然显示为红色下划线。我在任何地方使用 NameValuePair 也显示为红色。这使得区分合法错误和虚假错误变得非常困难。在我们的一些源代码中,我们还不能更新,滚动条旁边的整个屏幕右侧几乎都是红色的,都是假错误。

我该如何纠正这个问题?这真的很烦人。

编辑:我想在这里添加建议,How to use the legacy Apache HTTP client on Android Marshmallow? ,实际上并没有解决我的问题。我的问题是 Android studio 的 editor ;这不是实际的编译运行时问题。

最佳答案

这是 Android Studio 中的一个问题,尚未发布:Issue 183668: new useLibrary mechanism not supported in Studio

关于android - 允许遗留代码后如何修复 android studio 中的 lint?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32485622/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com