如何修复“Execution failed for task ':app:lintVitalRelease'”问题

7

当我签署我的Android应用程序时,会出现以下错误:

Execution failed for task ':app:lintVitalRelease'.
> Could not resolve all files for configuration ':app:lintClassPath'.
   > Could not find lint-gradle-27.1.0.jar (com.android.tools.lint:lint-gradle:27.1.0).
     Searched in the following locations:
         https://dl.google.com/dl/android/maven2/com/android/tools/lint/lint-gradle/27.1.0/lint-gradle-27.1.0.jar
   > Could not find lint-27.1.0.jar (com.android.tools.lint:lint:27.1.0).
     Searched in the following locations:
         https://dl.google.com/dl/android/maven2/com/android/tools/lint/lint/27.1.0/lint-27.1.0.jar
   > Could not find lint-checks-27.1.0.jar (com.android.tools.lint:lint-checks:27.1.0).
     Searched in the following locations:
         https://dl.google.com/dl/android/maven2/com/android/tools/lint/lint-checks/27.1.0/lint-checks-27.1.0.jar
   > Could not find lint-api-27.1.0.jar (com.android.tools.lint:lint-api:27.1.0).
     Searched in the following locations:
         https://dl.google.com/dl/android/maven2/com/android/tools/lint/lint-api/27.1.0/lint-api-27.1.0.jar
   > Could not find intellij-core-27.1.0.jar (com.android.tools.external.com-intellij:intellij-core:27.1.0).
     Searched in the following locations:
         https://dl.google.com/dl/android/maven2/com/android/tools/external/com-intellij/intellij-core/27.1.0/intellij-core-27.1.0.jar
   
     Searched in the following locations:
         https://dl.google.com/dl/android/maven2/com/android/tools/build/aapt2-proto/4.1.0-alpha01-6193524/aapt2-proto-4.1.0-alpha01-6193524.jar

Possible solution:
 - Declare repository providing the artifact, see the documentation at https://docs.gradle.org/current/userguide/declaring_repositories.html

当我将这个添加到我的应用程序中:

lintOptions {
    quiet true
    // Whether lint should set the exit code of the process if errors are found
    abortOnError false
    // Returns whether lint will only check for errors (ignoring warnings)
    ignoreWarnings true
    // Returns whether lint should check for fatal errors during release builds. Default is true.
    // If issues with severity "fatal" are found, the release build is aborted.
    checkReleaseBuilds false
}

那么就没有出现错误,但 APK 在我的手机上无法安装。


找到任何解决方案了吗? - TECNO
2个回答

4

我曾经遇到过你的问题:

  • 退出 Android Studio
  • 删除 gradle 缓存文件夹,路径是 C:\Users\{USER}\.gradle\caches
  • 重新运行 Android Studio 并重新构建

1

我也曾遇到过这个问题!我只是删除了这些文件:

project_folder/.gradle
project_folder/.idea
project_folder/.gradle
project_folder/build
project_folder/app/build
project_folder/app/release
C:\\users\Your_Name\.gradle\caches

然后打开Android Studio并再次执行。

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接