Googleservices.json表示不存在

时间:2018-04-23 22:06:12

标签: firebase dart flutter google-play-services


我学习扑了一下,试图安装firebase,它一直说“google-services.json”找不到,即使我把它放在正确的地方,也试过很多其他地方它实际上说的是“退出代码1来自:C:\ Users \ Samwise \ Desktop \ chatapp3 \ android \ gradlew.bat app:properties: 查看[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
}

1 个答案:

答案 0 :(得分:0)

根据repo issue中的评论,可能还不支持使用Google服务3.2.0的Firebase版本:

  

Firebase已转移到版本12+并使用版本3.2.0   google-services Gradle插件。应该跟随颤动/插件回购   服。

我有3.1.2愉快地工作,所以你可以试试。

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