没有找到与包名称匹配的客户端(Google Analytics) - 多个产品Flavors& buildTypes [英] No matching client found for package name (Google Analytics) - multiple productFlavors & buildTypes

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

问题描述

上下文

我正在尝试为我的应用设置Google Analytics。 (有4个自定义 buildTypes 和多个 productFlavors )



当我选择应用程序标识符设置为 Build Variant com.my.app.package.name (生成 google-services.json 时使用的软件包名称)。但是,我的其他口味有不同的applicationIds。



我遵循

在<$ c $中选择任何其他构建变体时出现错误c>构建变式选项卡(具有不同的 applicationId (包名称))如下所示:


错误:任务
'执行失败:app:processAllcategoriesDebugfreeGoogleServices'。


$ b


找不到匹配的客户端名称'com.my.app.package.name.debug'



错误消息的解释:



Debugfree 是我的自定义 buildType Allcategories 是我的 productFlavors 。



I unde rstand错误,并知道包名与我在生成json时使用的不同,但这正是我想要解决的问题。


$
$ b

现在, google-services.json 驻留在应用程序文件夹中,因此我无法通过将其放在特定于风味的源文件夹文件夹中将它们分开。



问题:
$ b


  1. 我的自定义 byildType 用于调试后缀 .debug applicationId (包名称)。有没有一种方法可以使它适用于我的发行版 applicationId google-services.json (即没有后缀 .debug

  2. 有没有办法在同一个 google- services.json 文件,而不使用单独的文件和任务将所需文件复制到 app 文件夹。我知道这可以使用 task 完成,如这篇文章。有没有更简单的方法来只有一个文件或基于gradle配置选择正确的文件?

  3. 我看到 package_name code> google-services.json 包名称 com.my.app.package.name 。我可以手动添加多个包名称以适用于所有构建变体吗?如果是的话,该怎么做?


解决方案

找到了这个:


google-services.json文件通常放置在app /
目录中,但版本2.0.0-alpha3对于构建类型添加了
插件支持,这会使以下目录
结构有效:

  app / src / 
main / google-services.json
dogfood / google-services.json
mytype1 / google-services.json
...


来源



来源2


Context:

I'm trying to set up Google Analytics for my app. (having 4 custom buildTypes and more than a few productFlavors)

It works fine when I select the Build Variant which has the applicationId set to com.my.app.package.name (the package name used when generating the google-services.json). But, my other flavors have different applicationIds.

I followed the offical devguide to set it up.

Error I get when any another build variant is selected in Build Variants Tab (which has a different applicationId (package name) is as follows:

Error:Execution failed for task ':app:processAllcategoriesDebugfreeGoogleServices'.

No matching client found for package name 'com.my.app.package.name.debug'

Explanation of Error Message:

In the task name in the error message above Debugfree is my custom buildType and Allcategories is one of my productFlavors.

I understand the error and know the package name is different from what i used when generating the json, but that is what I'm trying to figure a way around.

Problem:

Now, the google-services.json resides in the app folder and hence I am not being able to separate them out for each product flavor by dropping them in the flavor specific source set folder.

Questions:

  1. My custom byildType for debugging suffixes .debug to the applicationId (package name). Is there a way I can make it work with the google-services.json which has my release applicationId (i.e. without the suffix .debug)
  2. Is there a way to have multiple product flavors configured in the same google-services.json file without using separate files and tasks to copy the required file to app folder. I know it can be done using task as mentioned in this post. Is there a simpler way to just have one file or pick right file based on gradle configuration?
  3. I see the package_name field in google-services.json has the package name com.my.app.package.name. Can I add multiple package names manually to work for all build variants? If yes, how to do that? Could not find any instructions in documentations.

解决方案

Found this:

The google-services.json file is generally placed in the app/ directory, but as of version 2.0.0-alpha3 of the plugin support was added for build types, which would make the following directory structure valid:

app/src/
    main/google-services.json
    dogfood/google-services.json
    mytype1/google-services.json
    ...

Source

Source 2

这篇关于没有找到与包名称匹配的客户端(Google Analytics) - 多个产品Flavors&amp; buildTypes的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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