XML error when adding Google Analytics into my app

I had the same error and when i make res/xml folder & rebuild project it's helped to me.


I had the same error. Your Client Package name in google-services.json file and package name in your app must be same. It helped me.


Don't forget to add this

  1. Add the dependency to your project-level build.gradle:

    classpath 'com.google.gms:google-services:1.5.0-beta2'
    
  2. Add the plugin to your app-level build.gradle:

    apply plugin: 'com.google.gms.google-services'
    

I forgot to add this in my code, when I sync, and it's no error.