错误记录Android Studio 编译报错 ( Execution failed for task ‘:APP_MIDI:lintVitalRelease‘. )

Posted 韩曙亮

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了错误记录Android Studio 编译报错 ( Execution failed for task ‘:APP_MIDI:lintVitalRelease‘. )相关的知识,希望对你有一定的参考价值。

文章目录





一、报错信息



编译 Android 应用时 , 报如下错误 :

Execution failed for task ':app:lintVitalRelease'.
> Lint found fatal errors while assembling a release target.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.





二、解决方案



方案一

lint 检查报错 , 报错信息输出在 build/reports/lint-results-release-fatal.xml 文件中 , 可以通过改文件中的报错信息 , 修改相关语法错误 ;

报错信息示例 :

<?xml version="1.0" encoding="UTF-8"?>
<issues format="5" by="lint 4.1.0">

    <issue
        id="NotSibling"
        severity="Fatal"
        message="`@+id/button` is not a sibling in the same `RelativeLayout`"
        category="Correctness"
        priority="6"
        summary="Invalid Constraints"
        explanation="Layout constraints in a given `ConstraintLayout` or `RelativeLayout` should reference other views within the same relative layout (but not itself!)"
        errorLine1="        android:layout_below=&quot;@+id/button&quot;"
        errorLine2="        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
        <location
            file="D:\\Application\\app\\src\\main\\res\\layout\\activity_main.xml"
            line="836"
            column="9"/>
    </issue>

</issues>

方案二

在 build.gradle 中配置 取消 lint 检查 :

android
    lintOptions 
        checkReleaseBuilds false
        abortOnError false
    

以上是关于错误记录Android Studio 编译报错 ( Execution failed for task ‘:APP_MIDI:lintVitalRelease‘. )的主要内容,如果未能解决你的问题,请参考以下文章

错误记录Android Studio 编译报错 ( Could not determine java version from ‘11.0.8‘. | Android Studio 降级 )(代码片段

错误记录Android Studio 编译报错 ( Could not determine java version from ‘11.0.8‘. | Android Studio 降级 )(代码片段

错误记录Android Studio 编译时 Kotlin 代码编译报错 ( 升级支持库时处理 @NonNull 参数 )

错误记录Android Studio 编译报错 ( Invalid main APK outputs : EarlySyncBuildOutput )

错误记录Android Studio 编译报错 ( Invalid Gradle JDK configuration found )

错误记录Android Studio 编译报错 ( VirtualApp 编译 NDK 报错 | Error:A problem occurred configuring project ‘: )(代