我如何从 Gradle 项目的 Android SDK 工具中 运行 独立 lint
How do I run standalone lint from Android SDK Tools on a Gradle Project
当我尝试 运行 Android SDK 命令行工具中提供的 lint
工具时,它失败并出现以下错误
build.gradle: Error: "." is a Gradle project. To correctly analyze Gradle projects, you should run "gradlew lint" instead. [LintError]
1 errors, 0 warnings
我的用例要求我在 CI 环境中 运行 独立 lint,并进行特定检查。我该如何解决这个错误?
我四处搜索文档和答案。 Documentation doesn't have much information on the topic. I had found one answer 在发布此问题之前,但针对错误提供的建议也没有用。最后,正如切斯特所说,这根本就没有关系。
因为我是 运行 CI 环境中的工具,所以我最终做了以下事情
# delete the build.gradle files from the project
find . -type f -name "build.gradle" -exec rm -f {} \;
# run the lint with whatever checks. It works!!
lint --check Whatever .
# stash everything except the deleted files
git add **/*/build.gradle
git stash -k
# stash the deleted files
git stash
# drop the stash with deleted files
git stash drop
# pop the stash with everything else
git stash pop
这是一个肮脏的技巧。始终对更好的解决方案持开放态度!
当我尝试 运行 Android SDK 命令行工具中提供的 lint
工具时,它失败并出现以下错误
build.gradle: Error: "." is a Gradle project. To correctly analyze Gradle projects, you should run "gradlew lint" instead. [LintError]
1 errors, 0 warnings
我的用例要求我在 CI 环境中 运行 独立 lint,并进行特定检查。我该如何解决这个错误?
我四处搜索文档和答案。 Documentation doesn't have much information on the topic. I had found one answer 在发布此问题之前,但针对错误提供的建议也没有用。最后,正如切斯特所说,这根本就没有关系。
因为我是 运行 CI 环境中的工具,所以我最终做了以下事情
# delete the build.gradle files from the project
find . -type f -name "build.gradle" -exec rm -f {} \;
# run the lint with whatever checks. It works!!
lint --check Whatever .
# stash everything except the deleted files
git add **/*/build.gradle
git stash -k
# stash the deleted files
git stash
# drop the stash with deleted files
git stash drop
# pop the stash with everything else
git stash pop
这是一个肮脏的技巧。始终对更好的解决方案持开放态度!