【问题标题】:Googleservices.json says not present when it isGoogle Services.json 存在时不存在
【发布时间】:2018-04-23 22:06:11
【问题描述】:


我学习颤振并尝试安装firebase,它一直说找不到“google-services.json”,即使我把它放在正确的地方,也尝试了很多其他地方它实际上说的是“退出代码1 : C:\Users\Samwise\Desktop\chatapp3\android\gradlew.bat 应用程序:属性: 在查看 [src/nullnull/debug, src/debug/nullnull, src/nullnull, src/debug, src/nullnullDebug] 时找不到 google-services.json registerResGeneratingTask 已弃用,请使用 registerGeneratedFolders(FileCollection)"

非常感谢。

也是我的毕业生---

 build app 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.")
}

apply plugin: 'com.android.application'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"

android {
compileSdkVersion 26

defaultConfig {
    applicationId "com.test.test"
    minSdkVersion 21
    targetSdkVersion 25
    versionCode 1
    versionName "1.0"
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])


implementation'com.android.support:appcompat-v7:26.0.0'
implementation'com.android.support.constraint:constraint-layout:1.0.2'
implementation'com.android.support:cardview-v7:26.0.0'
implementation'com.android.support:support-v13:26.0.0'
implementation'com.android.support:design:26.0.0'
implementation'com.android.support:recyclerview-v7:26.0.0'

//firebase
implementation'com.google.android.gms:play-services-auth:12.0.1'
implementation'com.google.firebase:firebase-core:12.0.1'
implementation'com.google.firebase:firebase-auth:12.0.1'
implementation'com.google.firebase:firebase-database:12.0.1'
implementation'com.google.firebase:firebase-storage:12.0.1'
implementation'com.firebaseui:firebase-ui:2.2.0'

testImplementation 'junit:junit:4.12'
}

}



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

build root gradle

buildscript {
    repositories {
        google()
        jcenter()
    }

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

allprojects {
    repositories {
        google()
        jcenter()
        maven {
            url "https://maven.google.com" // Google's Maven repository
        }
    }
}

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

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

【问题讨论】:

  • gradle 文件似乎没有 google-service 插件,能否请您显示应用级别的 gradle 文件。

标签: firebase dart flutter google-play-services


【解决方案1】:

根据repo issue中的评论,可能尚不支持使用google service 3.2.0的Firebase版本:

Firebase 已升级到 12+ 版并使用 3.2.0 版 谷歌服务 Gradle 插件。颤振/插件回购应该遵循 西装。

我的 3.1.2 可以正常工作,所以你可以试试。

classpath 'com.google.gms:google-services:3.1.2'

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2018-03-01
    • 1970-01-01
    • 2018-04-10
    • 1970-01-01
    • 2021-06-11
    • 2018-05-13
    • 2018-10-27
    • 2016-10-04
    相关资源
    最近更新 更多