每当我尝试构建我的项目时,我都会不断收到此错误:
Execution failed for task ':app:processReleaseGoogleServices'.
No matching client found for package name 'com.my.package'
我制作并重新制作了 google-services.json
并使用了应用程序和程序包 com.my.package
。
这是我的项目 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'
}
这是我的应用程序 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'
我已经按照 此处 的说明进行了多次操作。我也在使用我的发布配置,因此 applicationIdSuffix 没有任何理由成为问题。此外,com.my.pacakage 只是我的 pacakge 名称的替代。我该怎么做才能解决这个问题?
原文由 MrEngineer13 发布,翻译遵循 CC BY-SA 4.0 许可协议
问题实际上出在 NewRelic 而不是我的配置。当我使用 BuildTypes 时,我删除了它并遵循 了这个答案。现在它按预期编译。