每次运行代码时,我都会收到此执行错误,并且' googleservices.json'存在于我的app文件夹中。我的SDK版本也已更新,但仍然在这些代码行中出错:
compile 'com.android.support:design:24.2.0'
compile 'com.android.support:appcompat-v7:24.2.0'
compile 'com.github.bumptech.glide:glide:3.6.1'
错误讯息:
Error:Execution failed for task ':app:processDebugGoogleServices'.
> File google-services.json is missing. The Google Services Plugin cannot
function without it.
Searched Location:
C:\Users\hp\AndroidStudioProjects\Friendly Chat\app\src\debug\google-
services.json
C:\Users\hp\AndroidStudioProjects\Friendly Chat\app\google-services.json
这是我的build.gradle代码。
apply plugin: 'com.android.application'
repositories {
mavenLocal()
flatDir {
dirs 'libs'
}
}
android {
compileSdkVersion 24
buildToolsVersion '25.0.0'
defaultConfig {
applicationId "com.google.firebase.udacity.friendlychat"
minSdkVersion 16
targetSdkVersion 24
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'),
'proguard-rules.pro'
}
}
packagingOptions {
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE-FIREBASE.txt'
exclude 'META-INF/NOTICE'
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:design:24.2.0'
compile 'com.android.support:appcompat-v7:24.2.0'
// Displaying images
compile 'com.github.bumptech.glide:glide:3.6.1'
}
apply plugin: 'com.google.gms.google-services'
答案 0 :(得分:0)
@Iqra确保包名与json文件中的名称相同
答案 1 :(得分:0)
您收到此错误的原因是因为您的路径包含空格char。
C:\Users\hp\AndroidStudioProjects\Friendly Chat\app\google-services.json
如您所见,Friendly Chat
中有空格。
请从目录名称(项目名称)中删除此空格,并将google-services.json
粘贴到app
目录中。
一条建议 - “在开发任何产品时,切勿在任何文件名或模块或目录名称中使用空格字符”。
答案 2 :(得分:0)
您需要从开发人员的站点获取配置文件并将其粘贴到项目文件夹的应用程序级别目录中。
答案 3 :(得分:0)
它的
谷歌-services.json
不是googleservices.json。
你错过了谷歌之间的连字符'和'服务'