1

I am Using Firebase Cloud Messaging for Push Notification.

I followed all instructions of official site and successfully added all requirements. But I am getting a Error and not able to find any solution.

My Error is:

  Error:Execution failed for task ':app:processInmemoryDebugGoogleServices'.
  > No matching client found for package name 'in.voiceme.app.voiceme.inmemory' 

where I added google-service.json see.

My Project structure Looking Like

enter image description here

I already added in dependencies:

   compile 'com.google.firebase:firebase-messaging:9.4.0'
   apply plugin: 'com.google.gms.google-services'

added classpath:

   buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        *classpath 'com.android.tools.build:gradle:2.1.3'*

        *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
    }
 }

My app based Build.Gradle

      apply plugin: 'com.android.application'

android {
    compileSdkVersion 24
    buildToolsVersion "23.0.3"

    defaultConfig {
        applicationId "in.voiceme.app.voiceme"
        minSdkVersion 16
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
        multiDexEnabled true
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }

    productFlavors {
        inmemory {
            applicationId "in.voiceme.app.voiceme.inmemory"
        }

        live {
            applicationId "in.voiceme.app.voiceme"
        }
     }
   }

    dependencies {
        compile fileTree(include: ['*.jar'], dir: 'libs')
        testCompile 'junit:junit:4.12'
        compile 'com.android.support:appcompat-v7:24.2.0'
        compile 'com.android.support:design:24.2.0'
        compile 'com.google.firebase:firebase-messaging:9.0.0'
    }
apply plugin: 'com.google.gms.google-services'

Can anyone give me solution about this Error?

Dinesh
  • 482
  • 9
  • 20

2 Answers2

0

Because the "inmemory" build flavor uses a different package name (applicationId) than the others, you need to modify your google-services.json file or perhaps provide multiple copies of it. The documentation for the Google Services Gradle Plugin describes the folder structure for different build types and flavors.

If you do not need different project settings for your apps build types and flavors, it might be possible to use a single file and add an entry to the client array in the file. The added entry would specify package name in.voiceme.app.voiceme.inmemory. See the linked document for more details, specifically the section on Processing the JSON File.

This answer to a related question will also be helpful.

Community
  • 1
  • 1
Bob Snyder
  • 37,759
  • 6
  • 111
  • 158
0

i solved this issue thanks to @qbix

 for productFlavors 

    inmemory {
        applicationId "in.voiceme.app.voiceme.inmemory"
    }

 Need to create different `google-service.json` using firebase console 
 and copy this json file into `inmemory` package.

i found problem was different pakageName not found by google-service.json, json file stores pakageName when we create this from Firebase Console.

provide new `google-service.json` to inmemory package is solution for that issue. thanks again @qbix  
Dinesh
  • 482
  • 9
  • 20