首页 > 解决方案 > 在 Flutter 项目的 build.gradle 中找不到 android 块

问题描述

我使用创建了一个 Flutter 项目flutter create my_app,它为我提供了一个完美运行的 Flutter 演示主页和一个例。
我现在正在按照官方文档测试应用程序的部署。我已根据需要创建了一个密钥库和一个文件,但在此处提到的文件中key.properties找不到该android块。 我尝试构建应用程序并在手机上启动它,但仍然缺少该块。我应该手动添加它还是我可能错过了一个步骤?build.grandle
build.gradleandroid

编辑:
这是我的 build.gradle 文件

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

    dependencies {
        classpath 'com.android.tools.build:gradle:4.1.0'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
    }
}

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

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

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

标签: androidfluttergradle

解决方案


该文件是android/app/build.gradle而不是/android/build.gradle.

对不起


推荐阅读