Android id为';gms:googleservices';尝试将推送通知集成到Flatter应用程序时未找到

Android id为';gms:googleservices';尝试将推送通知集成到Flatter应用程序时未找到,android,firebase,flutter,Android,Firebase,Flutter,我正在尝试将推送通知集成到firebase的futter应用程序中,我按照说明进行了操作。但每次我在我的android/app/build.gradle文件中添加“com.google.gms:google services”,我都会得到以下错误: FAILURE: Build failed with an exception. * Where: Build file 'C:\flutter_project\my_app\android\app\build.gradle' line: 27

我正在尝试将推送通知集成到firebase的futter应用程序中,我按照说明进行了操作。但每次我在我的android/app/build.gradle文件中添加“com.google.gms:google services”,我都会得到以下错误:

FAILURE: Build failed with an exception.

* Where:
Build file 'C:\flutter_project\my_app\android\app\build.gradle' line: 27

* What went wrong:
A problem occurred evaluating project ':app'.
> Plugin with id 'com.google.gms:google-services' not found.

* 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.

* Get more help at https://help.gradle.org
我曾尝试过在网上看到的其他解决方案,但没有一个对我有帮助。求你了,我需要帮助。 以下是我的颤振医生输出:

Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, 1.20.2, on Microsoft Windows [Version 10.0.18362.1016], locale en-US)

[√] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
[√] Android Studio (version 4.0)
[√] VS Code (version 1.48.2)
[√] Connected device (1 available)

• No issues found!
这是我的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' //defaulting code


android {
    compileSdkVersion 28

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

    lintOptions {
        disable 'InvalidPackage'
    }

    defaultConfig {
        // TODO: Specify your own unique Application ID
        applicationId "com.myapp.myapp"
        minSdkVersion 21
        targetSdkVersion 28
        versionCode flutterVersionCode.toInteger()
        versionName flutterVersionName
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
        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 {
    testImplementation 'junit:junit:4.12'
    
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'androidx.test:runner:1.1.1'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'
}
我也更新了我的颤振到最新版本,我仍然得到这个错误。我做错了什么?

应该是这样的
应用插件:“com.google.gms.google服务”

点,不是冒号。

首先:
您需要在项目级build.gradle中添加
classpath'com.google.gms:google services:4.3.3'

然后:
在android/app/build.gradle文件中添加“com.google.gms:googleservices”


我猜你错过了第一步。这是医生

你能想象吗?谢谢你,伙计!!我因为结肠一直失眠