Java 错误:任务 ':app: lintVitalRelease' 的执行失败有人可以解决吗?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/49286268/
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-12 02:59:10  来源:igfitidea点击:

Error: Execution failed for task ':app: lintVitalRelease' any one can solve it?

javaandroid

提问by elpatrue diab

Why I get this error I try to clean and rebuild application and make application release true and I get same error

为什么我收到这个错误 我尝试清理和重建应用程序并使应用程序发布为真,但我得到了同样的错误

Error:Execution failed for task ':app:lintVitalRelease'. java.lang.IllegalStateException: Expected BEGIN_ARRAY but was STRING at line 1 column 1 path $

错误:任务“:app:lintVitalRelease”的执行失败。java.lang.IllegalStateException:应为 BEGIN_ARRAY,但在第 1 行第 1 列路径 $ 处为 STRING

    apply plugin: 'com.android.application'

android {
    compileSdkVersion 25
    buildToolsVersion '26.0.2'
    useLibrary 'org.apache.http.legacy'
    defaultConfig {
        applicationId "x.x.x"
        minSdkVersion 15
        targetSdkVersion 25
        versionCode 95
        versionName '5'

        multiDexEnabled true
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    productFlavors {
    }

}

回答by nickc

Based off this Post

基于这篇文章

Edit:I removed the link because the thread is no longer there

编辑:我删除了链接,因为该线程不再存在

What you need to do is add this chunk of code to your build.gradle file in the android{} section

您需要做的是将这段代码添加到 android{} 部分的 build.gradle 文件中

lintOptions { 
    checkReleaseBuilds false
}

So like this

所以像这样

android {
    ...
    lintOptions {
        checkReleaseBuilds false
    }
}

Update:

更新:

Here is another post talking about a similar problem. It seems like there are various reasons this error can occur. While disabling the checkReleaseBuilds will work. It's recommended to find what the problem is and fix it. Most common error seems to be missing translations in the strings.xmlfile.

这是另一篇讨论类似问题的帖子。发生此错误的原因似乎有多种。禁用 checkReleaseBuilds 将起作用。建议找出问题所在并修复它。最常见的错误似乎是strings.xml文件中缺少翻译。

I recommend checking out this post for more help

我建议查看这篇文章以获得更多帮助

Error when generate signed apk

生成签名的apk时出错

回答by Makvin

lintOptions {
        checkReleaseBuilds false
        abortOnError false
    }

回答by Ilia Grabko

To find out why lint fails do this:

要找出 lint 失败的原因,请执行以下操作:

  1. Run lintVitalRelease
  1. 运行 lintVitalRelease

You can doit from gradle window

你可以从 gradle 窗口做

enter image description here

在此处输入图片说明

  1. Under Run tab you will see error logs
  1. 在运行选项卡下,您将看到错误日志

enter image description here

在此处输入图片说明

For me it was wrong constraint in ConstraintLayout xml.

对我来说,这是 ConstraintLayout xml 中的错误约束。

enter image description here

在此处输入图片说明

回答by Behrouz.M

The error report is saved to [app module]/build/reports/lint-results-yourBuildName-fatal.html. You can open this file in a browser to read about the errors.

错误报告保存到[app module]/build/reports/lint-results-yourBuildName-fatal.html. 您可以在浏览器中打开此文件以了解错误信息。

src: https://stackoverflow.com/a/50239165/365229

源代码:https: //stackoverflow.com/a/50239165/365229

回答by Ming Aivo

Make sure to have jcenter()in both buildscript and allprojects in your build.gradle android{} section

确保 jcenter()在 build.gradle android{} 部分中同时包含 buildscript 和 allprojects

回答by Emmanuel Ametepee

Open your build.gradle file and add the code below under android:

打开您的 build.gradle 文件并在 android 下添加以下代码:

android {

安卓 {

lintOptions { checkReleaseBuilds false }

lintOptions { checkReleaseBuilds false }