找不到与包名称匹配的客户端(Google Analytics(分析))-多个productFlavors/应用ID [英] No matching client found for package name (Google Analytics) - multiple productFlavors/application ids

查看:57
本文介绍了找不到与包名称匹配的客户端(Google Analytics(分析))-多个productFlavors/应用ID的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在为我的Android应用程序设置Firebase,但遇到了一些小问题.我有多种产品口味,例如标准的 dev qa prod .这些产品口味共享相同的应用程序ID.但是,我有一种口味,其中应用程序ID是不同的:

  productFlavors {开发{applicationId"com.acme.myandroidapp"}qa {applicationId"com.acme.myandroidapp"}foo {applicationId"com.acme.foo"}产品{applicationId"com.acme.myandroidapp"} 

这导致我的gradle构建失败,并出现找不到与包名称'com.acme.foo'相匹配的客户端"错误.

我已经看过这两个版本:否找到与包名称匹配的客户端(Google Analytics(分析))-多个productFlavors& google-services.json用于不同的productFlavor

不幸的是,这两个问题都没有解决针对特定产品风味使用不同应用程序ID的难题.我确实尝试过将google-services.json文件的副本放在每种形式的基础上,但没有任何乐趣.

关于如何在Android下使用Google服务支持不同的applicationId的想法?

解决方案

您可以在Firebase控制台的项目"设置中为两个应用程序ID添加应用程序.

这样做,新的google-services.json文件将包含两个客户端信息,每个应用程序ID均为1.

在每种口味的底部放置google-services.json文件的副本应该可以解决该问题.

I am setting up Firebase for my Android application and have run into a slight wrinkle/problem. I have multiple product flavors such as the standard dev, qa and prod. These product flavors share the same application id. However, I have one flavor where the application id is different:

productFlavors {
    dev {
        applicationId "com.acme.myandroidapp"
    }
    qa {
        applicationId "com.acme.myandroidapp"
    }
    foo {
        applicationId "com.acme.foo"
    }
    prod {
        applicationId "com.acme.myandroidapp"
    }

This is causing my gradle build to fail with a "No matching client found for package name 'com.acme.foo'" error.

I have looked at both: No matching client found for package name (Google Analytics) - multiple productFlavors & buildTypes and google-services.json for different productFlavors

Unfortunately, neither question deals with the wrinkle of having a different application id for a particular product flavor. I did try putting a copy of the google-services.json file at the base of each flavor but there was no joy.

Thoughts on how do you support different applicationIds with Google Services under Android?

解决方案

You can Add app for both the application Ids in Project setting in Firebase Console.

By doing so the new google-services.json file will contain two client-info, 1 for each application ID.

Putting a copy of the google-services.json file at at the base of each flavor should solve the issue.

这篇关于找不到与包名称匹配的客户端(Google Analytics(分析))-多个productFlavors/应用ID的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆