gpt4 book ai didi

android - 在 android 中使用 Twitter4j,在库中出现 lint 错误 - 库中的包引用无效

转载 作者:塔克拉玛干 更新时间:2023-11-02 08:01:28 25 4
gpt4 key购买 nike

我在 Android 应用程序中使用 twitter4j 来使用 twitter API。一切正常,图书馆也没有问题。今天我运行了 lint,但在 twitter4j-core-3.0.3.jar 中出现了 lint 错误。我无法控制这个第三方库,所以应该怎么办。

lint 错误如下:

库中的包引用无效;未包含在 Android 中:javax.management.openmbean。引用自 twitter4j.management.APIStatisticsOpenMBean。

Issue: Finds API accesses to APIs that are not supported in Android

Id: InvalidPackage

This check scans through libraries looking for calls to APIs that are not included in Android.

When you create Android projects, the classpath is set up such that you can only access classes in the API packages that are included in Android. However, if you add other projects to your libs/ folder, there is no guarantee that those .jar files were built with an Android specific classpath, and in particular, they could be accessing unsupported APIs such as java.applet.

This check scans through library jars and looks for references to API packages that are not included in Android and flags these. This is only an error if your code calls one of the library classes which wind up referencing the unsupported package.

最佳答案

如果您从命令行运行 Lint,您可以在您的项目目录中提供一个 lint.xml 并使用以下配置来忽略 twitter4j jar 文件。

<?xml version="1.0" encoding="UTF-8"?>
<lint>
<issue id="InvalidPackage">
<ignore path="libs/twitter4j-core-3.0.5.jar" />
</issue>
</lint>

可以在 http://developer.android.com/tools/help/lint.html 找到 Lint 的命令行选项

关于android - 在 android 中使用 Twitter4j,在库中出现 lint 错误 - 库中的包引用无效,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16184109/

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