如何解决此问题:“运行 android lint”问题

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/12243762/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-20 10:09:26  来源:igfitidea点击:

How to solve this : 'Running android lint' issue

androideclipsenullpointerexceptionandroid-lint

提问by AndroidLearner

In any activity of my project, if i do some changes and then save that activity i got the message "Running android lint has encountered a problem."

在我项目的任何活动中,如果我做了一些更改然后保存该活动,我会收到消息“运行 android lint 遇到问题”。

This is the my error log :

这是我的错误日志:

java.lang.NullPointerException
at com.android.ide.eclipse.adt.AdtUtils.workspacePathToFile(AdtUtils.java:466)
at com.android.ide.eclipse.adt.internal.lint.EclipseLintClient.getClassPath(EclipseLintClient.java:753)
at com.android.tools.lint.client.api.LintClient.getJavaClassFolders(LintClient.java:198)
at com.android.tools.lint.detector.api.Project.getJavaClassFolders(Project.java:270)
at com.android.tools.lint.client.api.LintDriver.checkIndividualClassFiles(LintDriver.java:977)
at com.android.tools.lint.client.api.LintDriver.checkClasses(LintDriver.java:920)
at com.android.tools.lint.client.api.LintDriver.runFileDetectors(LintDriver.java:785)
at com.android.tools.lint.client.api.LintDriver.checkProject(LintDriver.java:661)
at com.android.tools.lint.client.api.LintDriver.analyze(LintDriver.java:288)
at com.android.ide.eclipse.adt.internal.lint.LintJob.run(LintJob.java:151)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)\

I don't to know how to solve this.

我不知道如何解决这个问题。

采纳答案by Sathish

However, the root cause here is some sort of invalid project definition -- one or more of the class path entries are pointing to a resource which can't be opened; for example, you might have a classpath reference which is relative to a class path variable, and the class path variable is no longer pointing to an absolute location.

然而,这里的根本原因是某种无效的项目定义——一个或多个类路径条目指向一个无法打开的资源;例如,您可能有一个相对于类路径变量的类路径引用,并且类路径变量不再指向绝对位置。

The above CL will simply make sure that lint doesn't throw an exception in this scenario, but it won't be able to do actually include the given reference.

上面的 CL 将简单地确保 lint 在这种情况下不会抛出异常,但它实际上无法包含给定的引用。

You'll want to look at the project properties dialog and make sure all the build paths and resources are correct -- and that's the workaround until this issue is integrated

您需要查看项目属性对话框并确保所有构建路径和资源都是正确的——这是解决此问题之前的解决方法

回答by Bill

The following steps helped me to solve the same issue.

以下步骤帮助我解决了同样的问题。

  1. On My Project -> Context Menu -> Android Tools -> Fix Project Properties
  2. Changing to latest version in AndroidManifest.xml

    android:targetSdkVersion="21"
    
  1. My Project -> Context Menu -> Android Tools -> Fix Project Properties
  2. AndroidManifest.xml 中更改为最新版本

    android:targetSdkVersion="21"
    

Maybe just one of them is enough :).

也许只有其中之一就足够了:)。

回答by IntelliJ Amiya

In Window > Preferences > Android > Lint Error Checking; Uncheck "When saving files check for errors".

Window > Preferences > Android > Lint Error Checking; 取消选中“保存文件时检查错误”。

I hope it will helps you

我希望它会帮助你

回答by anetha

What worked for me was to open the "appcompat_v7" project on my Package explorer. I had closed it before and forgot to open so I got the same problem as OP. Now it's all fixed

对我有用的是在我的包浏览器上打开“appcompat_v7”项目。我之前已经关闭它并忘记打开它,所以我遇到了与 OP 相同的问题。现在一切都解决了

回答by Peter Gruppelaar

Here is another solution, just tested it.

这是另一个解决方案,刚刚测试了它。

Go to Project properties -> Javaand set compiler change Compiler compliance level: to 1.7.

转到Project properties -> Java并将编译器更改编译器合规级别设置为 1.7。

If this is not working then try Project properties -> Androidswitch from what ever it is using to android 4.4.2.

如果这不起作用,请尝试Project properties -> Android从它使用的任何版本切换到 android 4.4.2。

回答by vaFyreHeart

In my particular case, the problem was caused by conflicting key bindings.

在我的特殊情况下,问题是由冲突的键绑定引起的。

Check .metadata/.log in your project folder for hints.

检查项目文件夹中的 .metadata/.log 以获取提示。

回答by Developer

Why this Error?

为什么会出现这个错误?

It seems that its something related to appcompat_v7 library that we have in our package Explorer. If you are working with API (targetSdkVersion) level 21 you would not face this issue.

它似乎与我们在包资源管理器中拥有的 appcompat_v7 库有关。如果您使用 API (targetSdkVersion) 级别 21,则不会遇到此问题。

For Mac OS X Operating System :

对于 Mac OS X 操作系统:

Go to Menu : Eclipse -> Preferences -> Android -> Lint Error Checking and Un-Check : "When saving files, check for errors"

转到菜单:Eclipse -> 首选项 -> Android -> Lint 错误检查和取消检查:“保存文件时,检查错误”

For Windows Operating System :

对于 Windows 操作系统:

Go to Menu : Window -> Preferences -> Android -> Lint Error Checking and Un-Check : "When saving files, check for errors"

转到菜单:窗口 -> 首选项 -> Android -> Lint 错误检查和取消检查:“保存文件时,检查错误”

You may find this post helpful : http://code2care.org/pages/solution-running-android-lint-has-encountered-a-problem-nullpointerexception-error/

您可能会发现这篇文章很有帮助:http: //code2care.org/pages/solution-running-android-lint-has-encountered-a-problem-nullpointerexception-error/