gpt4 book ai didi

android - 是否可以将所有客户端信息只写入一个agconnect-services.json文件?

转载 作者:行者123 更新时间:2023-12-05 06:05:38 28 4
gpt4 key购买 nike

我想使用 Push Kit,并且在我的项目中使用了产品 flavor 。我的项目中有 4 种不同的构建变体和包名称。

enter image description here

包名称:

variant: blueDebug           -  package_name: com.omfaer.pflavors.blue.debug
variant: blueRelease - package_name: com.omfaer.pflavors.blue
variant: developmentDebug - package_name: com.omfaer.pflavors.debug
variant: developmentRelease - package_name: com.omfaer.pflavors

我已将 agconnect-services.json 添加到不同的目录。它以这种方式工作。

enter image description here

我的问题:

是否可以将所有客户端信息只写入一个agconnect-services.json文件。客户端信息不能写成json文件中的数组吗?

例如,我通过如下所示为两个不同的调试变体编辑 json 文件来尝试此操作,但它不起作用。

{
"agcgw":{
"websocketbackurl":"connect-ws-dre.hispace.dbankcloud.cn",
"backurl":"connect-dre.dbankcloud.cn",
"websocketurl":"connect-ws-dre.hispace.dbankcloud.com",
"url":"connect-dre.hispace.hicloud.com"
},
"client":[
{
"appType":"1",
"cp_id":"****************",
"product_id":"************",
"client_id":"************",
"client_secret":"********************",
"project_id":"******************",
"app_id":"123456789",
"api_key":"********************************************",
"package_name":"com.omfaer.pflavors.debug"
},
{
"appType":"1",
"cp_id":"****************",
"product_id":"************",
"client_id":"************",
"client_secret":"********************",
"project_id":"******************",
"app_id":"987654321",
"api_key":"********************************************",
"package_name":"com.omfaer.pflavors.blue.debug"
}
],

...
}

查看了华为推送服务文档和SDK集成文档。我看过下面的链接。我还查看了示例代码。

https://developer.huawei.com/consumer/en/doc/development/AppGallery-connect-Guides/agc-config-flavor

https://developer.huawei.com/consumer/en/doc/development/HMSCore-Guides/service-introduction-0000001050040060

https://developer.huawei.com/consumer/en/doc/development/HMSCore-Examples/client-sample-code-0000001051066000

app/build.gradle

android {
...

signingConfigs {
release{
storeFile file('keystore.jks')
keyAlias '***'
keyPassword '********'
storePassword '********'
v1SigningEnabled true
v2SigningEnabled true
}
}

buildTypes {
release {
signingConfig signingConfigs.release
debuggable true
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}

debug {
signingConfig signingConfigs.release
debuggable true
applicationIdSuffix = '.debug'
}
}

flavorDimensions "default"
productFlavors {
development {
minSdkVersion 19
resConfigs("en", "xhdpi")
dimension "default"
}
blue {
applicationIdSuffix = '.blue'
dimension "default"
}
}

...
}

有解决办法吗?你能帮忙吗?

最佳答案

There is no .json file for .blue.debug in the question. What's the best way to do this? Should I create the "blue" directory under the "debug" directory or the "debug" directory under the "blue" directory? Do you have any other suggestions?

需要在AGC上创建一个.blue.debug工程,并下载对应的json文件,然后在工程中创建一个flavor,文件夹可以随意命名,只要flavor对应的包名是 即可。蓝色调试。然后把JSON文件放到这个文件夹下就可以了。

关于android - 是否可以将所有客户端信息只写入一个agconnect-services.json文件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/65956281/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com