任务':app:lintVitalRelease'的执行失败.扑 [英] Execution failed for task ':app:lintVitalRelease'. Flutter

查看:64
本文介绍了任务':app:lintVitalRelease'的执行失败.扑的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为什么会出现这些错误,所以我尝试发布apk

Why I get these errors I try to release apk

我运行"flutter build apk --release"

I run "flutter build apk --release"

任务':app:lintVitalRelease'的执行失败.配置根项目"android_intent"时出现问题.

Execution failed for task ':app:lintVitalRelease'. A problem occurred configuring root project 'android_intent'.

  • 出了什么问题:配置根项目"android_intent"时出现问题.
找不到

SDK位置.在local.properties文件中使用sdk.dir或使用ANDROID_HOME环境变量来定义位置.

SDK location not found. Define location with sdk.dir in the local.properties file or with an ANDROID_HOME environment variable.

android/app/build.gradle

android/app/build.gradle

def localProperties = new Properties() def localPropertiesFile = rootProject.file('local.properties') if (localPropertiesFile.exists()) {
    localPropertiesFile.withReader('UTF-8') { reader ->
        localProperties.load(reader)
    } }

def flutterRoot = localProperties.getProperty('flutter.sdk') if (flutterRoot == null) {
    throw new GradleException("Flutter SDK not found. Define location with  flutter.sdk in the local.properties file.") }

def flutterVersionCode = localProperties.getProperty('flutter.versionCode') if (flutterVersionCode == null) {
    flutterVersionCode = '1' }

def flutterVersionName = localProperties.getProperty('flutter.versionName') if (flutterVersionName == null) {
    flutterVersionName = '1.0' }

apply plugin: 'com.android.application' apply plugin: 'kotlin-android' apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"

android {
    compileSdkVersion 28

    sourceSets {
        main.java.srcDirs += 'src/main/kotlin'
    }

    lintOptions {
        disable 'InvalidPackage'
    }

    defaultConfig {
        // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
        applicationId "com.example.deleviry"

   minSdkVersion 21
        targetSdkVersion 28
        versionCode flutterVersionCode.toInteger()
        versionName flutterVersionName
        multiDexEnabled true
    }

    buildTypes {
        release {
            // TODO: Add your own signing config for the release build.
            // Signing with the debug keys for now, so `flutter run --release` works.
            signingConfig signingConfigs.debug
        }
    } }

flutter {
    source '../..' }

dependencies {
    implementation 'com.google.firebase:firebase-core:17.2.0'
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" }

apply plugin: 'com.google.gms.google-services'

android/build.gradle

android/build.gradle

buildscript {
    ext.kotlin_version = '1.3.50'
    repositories {
        google()
        jcenter()
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:3.5.0'
        classpath 'com.google.gms:google-services:4.3.3'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
    } }

allprojects {
    repositories {
        google()
        jcenter()
    } }

rootProject.buildDir = '../build' subprojects {
    project.buildDir = "${rootProject.buildDir}/${project.name}" } subprojects {
    project.evaluationDependsOn(':app') }

task clean(type: Delete) {
    delete rootProject.buildDir }

推荐答案

升级gradle构建工具似乎会破坏某些功能.

Upgrading gradle build tools seems to break some lints.

要解决此问题,您可以:

To fix this you can:

如果您的错误显示为debug/libs.jar,请先构建--debug,然后再发布--release.
如果您的错误显示为profile/libs.jar,则先构建--profile,再构建--release.

If your error says debug/libs.jar, build --debug then --release.
If your error says profile/libs.jar, build --profile then --release.

来自 https://github.com/flutter/flutter/issues/58247#issuecomment-636500680

如果上述方法无效,则可以禁用该检查.

If the above doesn't work you can disable the check.

添加 checkReleaseBuilds false .

android {
    ...
    lintOptions {
        disable 'InvalidPackage'
        checkReleaseBuilds false //<- add this line
    }
}

这篇关于任务':app:lintVitalRelease'的执行失败.扑的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆