Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
909 views
in Technique[技术] by (71.8m points)

android - Execution failed for task ':app:processReleaseGoogleServices'. > No matching client found for package name

Anytime I try to build my project I keep getting this error:

Execution failed for task ':app:processReleaseGoogleServices'.
No matching client found for package name 'com.my.package'

I have made and remade the google-services.json and have used the app and the package com.my.package.

Here's my project build.gradle:

buildscript {
  repositories {
    ...
  }
  dependencies {
    classpath 'com.android.tools.build:gradle:2.0.0-beta6'
    classpath 'com.github.JakeWharton:sdk-manager-plugin:220bf7a88a7072df3ed16dc8466fb144f2817070'
    classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
    classpath 'io.fabric.tools:gradle:1.+'
    classpath 'com.newrelic.agent.android:agent-gradle-plugin:4.265.0'
    classpath 'com.google.gms:google-services:2.0.0-alpha9'
  }
}
allprojects {
  repositories {
    ...
  }
}
// Define versions in a single place
ext {
  supportLibraryVersion = '23.2.0'
  playServicesVersion = '8.4.0'
}

Here's my app build.gradle:

  apply plugin: 'android-sdk-manager'
  apply plugin: 'com.android.application'
  apply plugin: 'io.fabric'
  apply plugin: 'newrelic'
  apply plugin: 'com.neenbedankt.android-apt'

  android {
    packagingOptions {
      exclude 'LICENSE.txt'
      exclude 'META-INF/LICENSE'
      exclude 'META-INF/LICENSE.txt'
      exclude 'META-INF/NOTICE'
      exclude 'META-INF/services/javax.annotation.processing.Processor'
    }

    dexOptions {
      jumboMode true
    }

    lintOptions {
      disable 'InvalidPackage'
      abortOnError false
    }

    compileSdkVersion 23
    buildToolsVersion '23.0.2'

    defaultConfig {
      applicationId "com.my.package"
      minSdkVersion 15
      targetSdkVersion 23
    }

    buildTypes {
      debug {
        applicationIdSuffix '.debug'
        versionNameSuffix '-DEBUG'
        ...
      }

      staging {
        applicationIdSuffix '.staging'
        versionNameSuffix '-STAGING'
        ...
      }

      release {
        ...
      }
    }
  }

  dependencies {
    compile "com.android.support:support-v4:$rootProject.supportLibraryVersion",
            "com.android.support:support-annotations:$rootProject.supportLibraryVersion",
            "com.android.support:percent:$rootProject.supportLibraryVersion",
            "com.android.support:appcompat-v7:$rootProject.supportLibraryVersion",
            "com.android.support:mediarouter-v7:$rootProject.supportLibraryVersion",
            "com.google.android.gms:play-services-base:$rootProject.playServicesVersion",
            "com.google.android.gms:play-services-cast:$rootProject.playServicesVersion",
            "com.google.android.gms:play-services-gcm:$rootProject.playServicesVersion",
            "com.google.android.gms:play-services-analytics:$rootProject.playServicesVersion",
            ...
            'com.newrelic.agent.android:android-agent:4.265.0',
            'com.android.support:multidex:1.0.0'
    compile 'com.squareup.dagger:dagger:1.2.1'
  }

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

I've followed the instructions here several times. I am also using my release configuration so there isn't any reason the applicationIdSuffix should be an issue. Also, com.my.pacakage is just a stand-in for my pacakge name. What can I do to resolve this issue?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

You need to provide google-services.json for all flavors (release and development etc)

Single google-services.json can have json/data for all flavors. Go to Google Developers Console and regenerate google-services.json file

Update

You can also create separate google-services.json files for flavors

https://developers.google.com/android/guides/google-services-plugin


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...