评估项目“:app”时出现问题。构建gradle问题

时间:2021-08-01 12:45:38

标签: firebase flutter gradle android-gradle-plugin build.gradle

我尝试运行我的第一个 firebase 应用程序,但由于此错误而无法运行:

FAILURE:构建失败,出现异常。

  • 哪里: 构建文件 'C:\Users\boras\OneDrive\Masaustu\Software\ProgramlamaTemelliYazilim\Flutter\firebase_application\firebase_application\android\app\build.gradle' 行:29
  • 出了什么问题: 评估项目“:app”时出现问题。
<块引用>

方法的无签名:)build_884xt67ny8crpgv70jgbem96p.android(为参数类型是适用的:(build_884xt67ny8crpgv70jgbem96p $ _run_closure2)值:[build_884xt67ny8crpgv70jgbem96p $ ure2)值:[build_884xt67ny8crpgv70jgbem96p $ _run_closure2 @ 1998e9ac]

  • 试试: 使用 --stacktrace 选项运行以获取堆栈跟踪。使用 --info 或 --debug 选项运行以获得更多日志输出。使用 --scan 运行以获得完整的见解。
  • 访问 https://help.gradle.org
  • 获取更多帮助

这就是我 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"
apply plugin: 'com.google.gms.google-services'

android {
    compileSdkVersion 30

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

    defaultConfig {
        // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
        applicationId "com.example.firebase_application"
        minSdkVersion 23
        targetSdkVersion 30
        versionCode flutterVersionCode.toInteger()
        versionName flutterVersionName
        multiDexEnabled true
        classpath 'com.android.tools.build:gradle:4.2.0'

    }

    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 "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"

    implementation platform('com.google.firebase:firebase-bom:26.3.0')
    implementation 'com.google.firebase:firebase-analytics'
    implementation 'com.google.firebase:firebase-messaging'

    testImplementation 'junit:junit:4.+'
    androidTestImplementation 'androidx.test.ext:junit:1.1.2'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'

    compile 'com.android.support:multidex:2.0.1'
    implementation platform('com.google.firebase:firebase-bom:28.3.0')
    classpath 'com.google.gms:google-services:4.2.0'
}

1 个答案:

答案 0 :(得分:0)

尝试更改您的以下版本:

compileSdkVersion 28

minSdkVersion 21

targetSdkVersion 30