1

Im trying to install push notifications and have followed the instructions on firebase, but after adding the lines in my gradle files and try to sync, I get get the following error.

Error:Execution failed for task ':app:processDebugGoogleServices'. No matching client found for package name 'com.project.myproject'

I downloaded the google-services.json file and put it in my apps folder under project.

here are my grade files

App

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.2.2'
        classpath 'com.google.gms:google-services:3.0.0'
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        jcenter()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

Module

apply plugin: 'com.android.application'

android {
    compileSdkVersion 24
    buildToolsVersion "24.0.2"

    defaultConfig {
        applicationId "com.project.myproject"
        minSdkVersion 15
        targetSdkVersion 24
        versionCode 39
        versionName "1.0.0.39"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:24.2.0'
    compile 'com.android.support:design:24.2.0'
    compile 'com.mcxiaoke.volley:library:1.0.18'
    compile 'com.android.support:support-v4:24.2.0'
    compile 'com.squareup.picasso:picasso:2.5.2'
    compile 'com.google.firebase:firebase-messaging:9.8.0'
}
apply plugin: 'com.google.gms.google-services'
Joe Cade
  • 357
  • 1
  • 2
  • 13
  • Can you post your tree-file hierarchy? Did you check if your google-services.json package_name is the same as your applicationId? – GuilhE Nov 04 '16 at 23:09
  • Possible duplicate of [No matching client found for package name (Google Analytics) - multiple productFlavors & buildTypes](http://stackoverflow.com/questions/34990479/no-matching-client-found-for-package-name-google-analytics-multiple-productf) – GuilhE Nov 04 '16 at 23:18
  • yes package name is the same. i spent an hour looking for this problem, found similar questions, but none of the answers work for me. but question. IS google-services.json only supposed to be in the APP folder? Or somewhere else also... for debugging etc? – Joe Cade Nov 04 '16 at 23:23
  • file tree hirachy? under project view? I only have ONE google services file in the app folder – Joe Cade Nov 04 '16 at 23:26
  • You can use only one if you don't need different files for each flavour. If you need it you should create a different project for each (in the firebase console) and then use the respective .json for the right flavour: http://stackoverflow.com/a/39305974/1423773 – GuilhE Nov 04 '16 at 23:26
  • ok. i only NEED one. was just wondering if i HAD to add the same one in different folders : ) – Joe Cade Nov 04 '16 at 23:31

1 Answers1

0

Use this,

    compile 'com.google.firebase:firebase-auth:9.4.0'
    compile 'com.google.firebase:firebase-database:9.4.0'
    compile 'com.google.firebase:firebase-config:9.4.0'
    compile 'com.google.firebase:firebase-core:9.4.0'
    compile 'com.google.firebase:firebase-messaging:9.4.0'

the services you need specifically. Find a list of them here

compile 'com.google.android.gms:play-services-analytics:9.4.0'
compile 'com.google.android.gms:play-services-appinvite:9.4.0'
compile 'com.google.android.gms:play-services-maps:9.4.0'
compile 'com.google.android.gms:play-services-location:9.4.0'
compile 'com.google.android.gms:play-services-plus:9.4.0'
compile 'com.google.android.gms:play-services-drive:9.4.0'

Also, you need to apply play service plugin in last line of your application's gradle:

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

check this one in gradle also,

  dependencies {
        classpath 'com.android.tools.build:gradle:2.0.0-alpha6' 
}

And one more majore note is,

The google-services.json file is generally placed in the app/ directory,

app/google-services.json

Note:

Check your package name on your google-services.json

Example (provided by Muhammed Fasil):

"client_info": {
    "mobilesdk_app_id": "1:6596814400689:android:65d6f25f5006145",
    "android_client_info": {
      "package_name": "com.my.app.package.name"
    }
Community
  • 1
  • 1
Ajith K P
  • 398
  • 3
  • 12
  • If you pay close attention to the question you'll find that the user is making practically everything you mention, and you should also give the right credit where you get "your" answers ;) http://stackoverflow.com/a/38198021/1423773 – GuilhE Nov 04 '16 at 23:19
  • Thank. I just looked into all the above, but no luck so far. – Joe Cade Nov 04 '16 at 23:24