小编And*_*yev的帖子

连接插件“com.google.gms.google-services”时出现错误“没有此类属性:类的 applicationVariants:java.lang.String”

我正在使用最新版本的 Android Studio 和所有插件。我正在尝试将 Android 应用程序连接到 firebase 控制台。已成功下载 google-services.json 文件并添加到模块根目录。在 build.gradle 文件中添加了“classpath 'com.google.gms: google-services: 4.3.3”和“apply plugin:' com.google.gms.google-services'”行。

build.gradle项目级别:

buildscript {
    repositories {
        google()
        jcenter()

    }
    dependencies {
        classpath 'com.android.tools.build:gradle:4.0.1'
        classpath 'com.google.gms:google-services:4.3.3'
        
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        google()
        jcenter()

    }
}
Run Code Online (Sandbox Code Playgroud)

build.gradle应用程序级别:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 29
    buildToolsVersion "29.0.2"
    defaultConfig {
        applicationId "app"
        minSdkVersion 16
        targetSdkVersion 29
        versionCode 42
        versionName …
Run Code Online (Sandbox Code Playgroud)

firebase android-studio android-gradle-plugin

6
推荐指数
1
解决办法
695
查看次数