扑:迁移到androidx

时间:2019-08-08 08:58:36

标签: android flutter google-play-services androidx

使用android studio时,创建一个新项目并将以下条目添加到: url_for(subject_action, subject=1234, ...(相关性):

android/build.gradle

classpath 'com.google.gms:google-services:4.3.0' (在底部)

android/app/build.gradle

gradle构建失败,并出现以下错误:

apply plugin: 'com.google.gms.google-services'

当我停止应用Google服务所需的google-services插件时,此错误消失了。 Flutter已升级到最新版本。

完整的构建文件:

Finished with error: Gradle task assembleDebug failed with exit code 1

和:

buildscript {
    repositories {
        google()
        jcenter()
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:3.4.2'
        classpath 'com.google.gms:google-services:4.3.0'
    }
}

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

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

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

1 个答案:

答案 0 :(得分:1)

要完成setup of the google play services plugin,您必须

  • 添加google-services.json文件。
  

此文件通常放置在app/ directory中(位于Android Studio应用模块的根目录中)。从2.2.0版开始,该插件支持构建类型和产品风味特定的JSON文件。以下所有目录结构均有效:

// dogfood and release are build types.
app/
    google-services.json
    src/dogfood/google-services.json
    src/release/google-services.json