android - 使用多风格编译 GMS 和 HMS 包。但是GMS版本编译的时候报错
问题描述
我有一个应用程序配置了两种编译风格,一种使用 HMS,另一种不使用。编译不使用HMS的flavor时,包名与json文件不一致。结果,发生错误。
Task failed with an exception.
-----------
* What went wrong:
Execution failed for task ':app:processAppgalleryconnectLatestDebugAGCPlugin'.
> ERROR: Failed to verify AGConnect-Config '/client/package_name', expected: 'com.dise.appge.hms', but was: 'com.dise.appge.gms'
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
==============================================================================
那么当不同风味使用不同的包名时如何解决这个问题呢?
解决方案
各个插件可以在productFlavors
块中应用,无需比较任何东西:
flavorDimensions "vendor"
productFlavors {
google {
dimension "vendor"
apply plugin: "com.google.gms.google-services"
apply plugin: "com.google.firebase.crashlytics"
applicationIdSuffix ".gms"
}
huawei {
dimension "vendor"
apply plugin: "com.huawei.agconnect"
applicationIdSuffix ".hms"
}
}
推荐阅读
- asynchronous - Shiny - 在执行异步任务时更改 actionButton 的颜色
- r - 使用 plot3D 更改图形的轴标题相对于轴本身的距离或旋转
- javascript - 最后开始读取 json 文件
- mysql - 当我在 amazon-ec2 中访问 mysqldb 时,远程访问被拒绝。(1045,“用户'user-name'@'some-ip'的访问被拒绝)
- javascript - 在带有 JS 的自定义类中调用 onmousedown 和 onclick
- android - ConstraintLayout 使用模拟器运行后是无序的
- java - java.io.IOException 连接由异步 http 客户端中的对等方重置
- c# - 如何自定义 text-danger 给出的验证错误消息?
- python - Python删除数组中的特定值
- python - 在pyspark中用整数编码一列