Firebase - 缺少API密钥 [英] Firebase - Missing Api Key
本文介绍了Firebase - 缺少API密钥的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
$ b
错误:任务:app:processDebugGoogleServices的执行失败。
缺少api_key / current_key对象
那么我不知道应该把api键放在哪里。
这是我的gradle(模块应用程序)
apply plugin:'com.android.application'
$ p
apply plugin:'com.google.gms.google-services'
android {
compileSdkVersion 23
buildToolsVersion 23.0.1
defaultConfig {
applicationIdcom.udacity.firebase.shoppinglistplusplus
minSdkVersion 15
targetSdkVersion 23
versionCode 1
versionName1.0
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'),'proguard-rules.pro'
it.buildConfigField'String','UNIQUE_FIREBASE_ROOT_URL',UniqueFirebaseRootUrl
}
debug {
}
}
/ *跟随着回购。由于您将拥有不同的
*根网址,因此此代码会从您的gradle.properties文件中加载一个值。
* /
buildTypes.each {
it.buildConfigField'String','UNIQUE_FIREBASE_ROOT_URL',UniqueFirebaseRootUrl
}
packagingOptions {
排除'META-INF / LICENSE'
排除'META-INF / LICENSE-FIREBASE.txt'
排除'META-INF / NOTICE'
}
编译fileTree(dir:'libs',include:['* .jar'])
compile'com.android.support:appcompat- v7:23.0.1'
compile'com.android.support:design:23.0.1'
compile'com.android.support:support-v4:23.0.1'
compile' com.android.support:cardview-v7:23.0.1'
/ * Firebase SDK * /
编译'com.firebase:firebase-client-android:2.4.0'
/ * Firebase UI * /
编译'com.firebaseui:firebase-ui:0.2.2'
/ *对于Google Play服务* /
编译'com.google.android.gms:play-services-safetynet:9.0.0'
compile'com.google.android.gms:play-service s-auth:9.0.0'
}
apply plugin:'com.google.gms.google-services'
$ b这是gradle(project)
$ b $ pre $ code > //顶级构建文件,您可以在其中添加
所有子项目/模块通用的配置选项。
uildscript {
repositories {
jcenter()
}
依赖关系{
classpath'com.android.tools.build:gradle: 1.3.1'
classpath'com.google.gms:google-services:3.0.0'
//注意:不要在这里放置您的应用程序依赖关系;它们属于单个模块build.gradle文件中的
//
}
}
allprojects {
repositories {
jcenter()
如果有些东西是缺少的,请让我知道解决方案非常感谢球员,我删除了Jsonfile并再次下载。可能我有问题,该文件。现在它的固定!
I'm using Google's Firebase database. I have registered to the Firebase Console and also downloaded the JSON file, but for some reason it gives me that kind of error.
Error:Execution failed for task ':app:processDebugGoogleServices'. Missing api_key/current_key object
Well I don't know where should I put the api key.
this is my gradle(module app)
apply plugin: 'com.android.application' apply plugin: 'com.google.gms.google-services' android { compileSdkVersion 23 buildToolsVersion "23.0.1" defaultConfig { applicationId "com.udacity.firebase.shoppinglistplusplus" minSdkVersion 15 targetSdkVersion 23 versionCode 1 versionName "1.0" } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' it.buildConfigField 'String','UNIQUE_FIREBASE_ROOT_URL', UniqueFirebaseRootUrl } debug { } } /* This for anyone following along with the repo. Since you will have a different * root URL, this code loads up a value from your gradle.properties file. */ buildTypes.each { it.buildConfigField 'String', 'UNIQUE_FIREBASE_ROOT_URL', UniqueFirebaseRootUrl } packagingOptions { exclude 'META-INF/LICENSE' exclude 'META-INF/LICENSE-FIREBASE.txt' exclude 'META-INF/NOTICE' } } dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) compile 'com.android.support:appcompat-v7:23.0.1' compile 'com.android.support:design:23.0.1' compile 'com.android.support:support-v4:23.0.1' compile 'com.android.support:cardview-v7:23.0.1' /* Firebase SDK */ compile 'com.firebase:firebase-client-android:2.4.0' /* Firebase UI */ compile 'com.firebaseui:firebase-ui:0.2.2' /* For Google Play Services */ compile 'com.google.android.gms:play-services-safetynet:9.0.0' compile 'com.google.android.gms:play-services-auth:9.0.0' } apply plugin: 'com.google.gms.google-services'
this is gradle(project)
// Top-level build file where you can add configuration options common to all sub-projects/modules. buildscript { repositories { jcenter() } dependencies { classpath 'com.android.tools.build:gradle:1.3.1' classpath 'com.google.gms:google-services:3.0.0' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files } } allprojects { repositories { jcenter() } }
If something is missing please let me know
解决方案Well thanks guys, i deleted the Jsonfile and download again. Probably i had problem with that file. now its fixed!
这篇关于Firebase - 缺少API密钥的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文