Error: Execution failed for task ': app: processDebugGoogleServices
Error: Execution failed for task ': app: processDebugGoogleServices
我在 Android Studio 中有一个错误。
新建activity空白申请,我加"build.gradle (project)"
dependencies {
classpath 'com.android.tools.build:gradle:2.0.0-alpha9'
classpath 'com.google.gms: google-services: 2.0.0-alpha9'
}
并在 "build.gradle (app)"
dependencies {
compile FileTree (dir: 'libs', include: ['* .jar'])
compile 'com.android.support:appcompat-v7:23.0.1'
compile 'com.android.support:design:23.0.1'
// Dependency for Google Sign-In
compile 'com.google.android.gms: play-auth-services: 8.4.0'
}
apply plugin: 'com.google.gms.google-services'
编译,错误为:
"Error: Execution failed for task ': app: processDebugGoogleServices'.
Com.google.gson.stream.MalformedJsonException: Expected name at line 28, column 20 "
我重新安装了Android Studio、SDK,还是一样,有什么想法吗?
您似乎正在 Google 登录您的应用。
apply plugin: 'com.google.gms.google-services'
语句将尝试解析您的 google-services.json
文件(通常位于应用程序文件夹中)
打开该文件并在第 28 行查找任何格式错误的 JSON。
(可能copy/paste它变成了online JSON validator)。
有时候编辑器修改'google-services.json'也会导致这个问题。我用OS X TextEdit编辑,出现了这个问题,但是我用UltraEdit后,问题就解决了。我想可能是文件编码问题。
我在 Android Studio 中有一个错误。 新建activity空白申请,我加"build.gradle (project)"
dependencies {
classpath 'com.android.tools.build:gradle:2.0.0-alpha9'
classpath 'com.google.gms: google-services: 2.0.0-alpha9'
}
并在 "build.gradle (app)"
dependencies {
compile FileTree (dir: 'libs', include: ['* .jar'])
compile 'com.android.support:appcompat-v7:23.0.1'
compile 'com.android.support:design:23.0.1'
// Dependency for Google Sign-In
compile 'com.google.android.gms: play-auth-services: 8.4.0'
}
apply plugin: 'com.google.gms.google-services'
编译,错误为:
"Error: Execution failed for task ': app: processDebugGoogleServices'. Com.google.gson.stream.MalformedJsonException: Expected name at line 28, column 20 "
我重新安装了Android Studio、SDK,还是一样,有什么想法吗?
您似乎正在 Google 登录您的应用。
apply plugin: 'com.google.gms.google-services'
语句将尝试解析您的 google-services.json
文件(通常位于应用程序文件夹中)
打开该文件并在第 28 行查找任何格式错误的 JSON。
(可能copy/paste它变成了online JSON validator)。
有时候编辑器修改'google-services.json'也会导致这个问题。我用OS X TextEdit编辑,出现了这个问题,但是我用UltraEdit后,问题就解决了。我想可能是文件编码问题。