没有找到与包名称匹配的客户端(Google Analytics) - 多个产品Flavors& buildTypes [英] No matching client found for package name (Google Analytics) - multiple productFlavors & buildTypes
问题描述
上下文:
我正在尝试为我的应用设置Google Analytics。 (有4个自定义 buildTypes
和多个
当我选择应用程序标识符
设置为的
com.my.app.package.name (生成 google-services.json
时使用的软件包名称)。但是,我的其他口味有不同的applicationIds。
找不到匹配的客户端名称'com.my.app.package.name.debug'
错误消息的解释:
在 Debugfree
是我的自定义 buildType
和 Allcategories
是我的 productFlavors
。
I unde rstand错误,并知道包名与我在生成json时使用的不同,但这正是我想要解决的问题。
$
$ b
现在, google-services.json
驻留在应用程序
文件夹中,因此我无法通过将其放在特定于风味的源文件夹文件夹中将它们分开。
问题:
$ b
- 我的自定义
byildType 用于调试后缀
.debug
到applicationId
(包名称)。有没有一种方法可以使它适用于我的发行版applicationId
的google-services.json
(即没有后缀.debug
) - 有没有办法在同一个
google- services.json
文件,而不使用单独的文件和任务将所需文件复制到app
文件夹。我知道这可以使用task
完成,如这篇文章。有没有更简单的方法来只有一个文件或基于gradle配置选择正确的文件? - 我看到
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
...
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:
- My custom
byildType
for debugging suffixes.debug
to theapplicationId
(package name). Is there a way I can make it work with thegoogle-services.json
which has my releaseapplicationId
(i.e. without the suffix.debug
) - 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 toapp
folder. I know it can be done usingtask
as mentioned in this post. Is there a simpler way to just have one file or pick right file based on gradle configuration? - I see the
package_name
field ingoogle-services.json
has the package namecom.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 ...
这篇关于没有找到与包名称匹配的客户端(Google Analytics) - 多个产品Flavors& buildTypes的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!