我在构建应用程序时得到这个错误。我甚至不知道这个问题是什么。我将发布完整的错误信息和问题所在的代码。
* Where:
脚本'C:\Users\DELL\Downloads\flutter_windows_2.10.2-stable\flutter\packages\flutter_tools\gradle\flutter.gradle' line: 73
What went wrong:
A problem occurred evaluating script.
在org.gradle.api.Project的':app'项目上找不到参数[flutter_3xtlcf8y4k96s78jza8a827pu$_run_closure1@50ef998a]的方法android()。
用--stacktrace选项运行,获得堆栈跟踪。
用--info或--debug选项运行,获得更多的日志输出。
使用--scan选项运行,以获得完整的洞察力。
下面你会发现flutter.gradle文件第73行应该是错误的地方。
buildscript {
repositories {
google()
mavenCentral()
dependencies {
/* When bumping, also update ndkVersion above. */
classpath 'com.android.tools.build:gradle:7.0.4'
android {
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
第73行以android {
开头
android/build.gradle。
buildscript {
ext.kotlin_version = '1.6.20'
repositories {
google()
mavenCentral()
jcenter()
dependencies {
classpath 'com.android.tools.build:gradle:7.0.4'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.google.gms:google-services:4.3.8'
allprojects {
repositories {
google()
mavenCentral()
jcenter()
的app/build.gradle。
apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
android {
compileSdkVersion 32
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.santosenoque.cabdriver"
minSdkVersion 23
targetSdkVersion 32
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
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
flutter {
source '../..'