【发布时间】:2021-03-09 10:46:53
【问题描述】:
这是我的 build.gradle(.app) 文件
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
android {
compileSdkVersion 29
buildToolsVersion "29.0.3"
defaultConfig {
applicationId "com.example.moviebookingapp"
minSdkVersion 27
targetSdkVersion 29
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'com.google.android.material:material:1.0.0'
implementation 'androidx.gridlayout:gridlayout:1.0.0'
implementation 'com.google.android.material:material:1.0.0'
implementation 'com.google.firebase:firebase-database:19.5.1'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
implementation'com.android.support:recyclerview-v7:29.3.1'
implementation 'com.basgeekball:awesome-validation:1.3'
implementation 'com.google.firebase:firebase-analytics:18.0.0'
implementation'com.google.firebase:firebase-database:19.5.1'
}
这是我的 build.gradle(电影预订应用程序)文件
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.1.0'
classpath "com.google.gms:google-services:4.3.4"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
google-services(1).json 是我添加的文件
这是错误即将到来。
Execution failed for task ':app:processDebugGoogleServices'.
> File google-services.json is missing. The Google Services Plugin cannot function without it.
Searched Location:
D:\ankita\android\moviebookingapp2\app\google-services.json
D:\ankita\android\moviebookingapp2\app\src\nullnull\google-services.json
D:\ankita\android\moviebookingapp2\app\src\debug\google-services.json
D:\ankita\android\moviebookingapp2\app\src\nullnullDebug\google-services.json
D:\ankita\android\moviebookingapp2\app\src\nullnull\debug\google-services.json
D:\ankita\android\moviebookingapp2\app\src\debug\nullnull\google-services.json
我尝试了很多其他方法,我也搜索了该文件是否添加,我都搜索过,我不知道我哪里出错了。
【问题讨论】:
-
第一件事,你有没有从你在firebase控制台中添加的项目中下载这个json文件?
-
你可能需要从firebase下载最新的json文件
-
是的,我只下载了最新版本
-
你把那个文件放在 app 里了吗?目录?
-
是的,我已放置
标签: android firebase android-studio android-layout firebase-realtime-database