4

I have a bug in Android Studio. New activity blank application, I add "build.gradle (project)"

 dependencies {
     classpath 'com.android.tools.build:gradle:2.0.0-alpha9'
     classpath 'com.google.gms: google-services: 2.0.0-alpha9'
 }

And in "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'

Compile, and the error is:

"Error: Execution failed for task ': app: processDebugGoogleServices'. Com.google.gson.stream.MalformedJsonException: Expected name at line 28, column 20 "

I reinstalled Android Studio, SDK, and always the same, any ideas?

John Vargas
  • 71
  • 1
  • 5
  • possible duplicate of http://stackoverflow.com/questions/32212623/adding-google-services-execution-failed-for-task-appprocessdebugresources – abielita Feb 04 '16 at 02:04
  • 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; compilas y error. – John Vargas Feb 05 '16 at 01:22
  • I managed the operation of Google SignIn removing "apply plugin: 'com.google.gms.google-services'' I do not know what consequences have but so far get user data. Regards. – John Vargas Feb 05 '16 at 04:38

2 Answers2

9

It looks like you are doing Google Sign-in in your app.
The apply plugin: 'com.google.gms.google-services' statement would try to parse your google-services.json file (normally located in the app folder)
Open that file and look for any malformed JSON at line 28.
(Possibly copy/paste it into an online JSON validator).

Magnus Johansson
  • 28,010
  • 19
  • 106
  • 164
0

Sometimes the editor use to modify the 'google-services.json' also will cause the issue. I use OS X TextEdit to edit, the issue happened, but after I use UltraEdit, the issue is solved. I think maybe the file coding issue.

Weidian Huang
  • 2,787
  • 2
  • 20
  • 29