【问题标题】:Error: Execution failed for task ': app: processDebugGoogleServices错误:任务执行失败:应用程序:processDebugGoogleServices
【发布时间】:2016-05-13 02:11:20
【问题描述】:

我在 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'

编译,报错:

“错误:任务':app:processDebugGoogleServices'的执行失败。 Com.google.gson.stream.MalformedJsonException:第 28 行第 20 列的预期名称“

我重新安装了 Android Studio、SDK,还是一样,有什么想法吗?

【问题讨论】:

  • Estás equivocado, revisa bien, el error lo puedes replicar fácilmente al crear un nuevo proyecto con actividad en blanco, agregar el classpath y apply plugin;编译错误。
  • 我管理了 Google SignIn 的操作,删除了“apply plugin: 'com.google.gms.google-services'' 我不知道有什么后果,但到目前为止得到了用户数据。问候。跨度>

标签: android android-studio google-play-services build.gradle


【解决方案1】:

您似乎正在应用中进行 Google 登录。
apply plugin: 'com.google.gms.google-services' 语句将尝试解析您的 google-services.json 文件(通常位于 app 文件夹中)
打开该文件并在第 28 行查找任何格式错误的 JSON。
(可能复制/粘贴到online JSON validator)。

【讨论】:

    【解决方案2】:

    有时编辑器用来修改“google-services.json”也会导致问题。我使用 OS X TextEdit 进行编辑,出现了问题,但使用 UltraEdit 后,问题解决了。我想可能是文件编码问题。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2018-06-16
      • 2020-04-29
      • 2018-11-08
      • 1970-01-01
      • 1970-01-01
      • 2016-10-20
      • 2021-09-26
      相关资源
      最近更新 更多