I'm trying to implement play services and huawei services in the same app, but want to be able to configure which one to use by flavor. Each flavor uses it's own applicationIdSuffix. So for each different flavor, huawei plugin fails and I cannot compile.
I have app module that contains agconnect-services.json file in it's root. How could I specify different versions of this file for each build flavor?
If it's not possible, then in my root build.gradle file I have this line:
classpath 'com.huawei.agconnect:agcp:1.1.1.300'
Is it possible to use this line only on specific flavor?
The possible cause is that your AppGallery Connect plug-in version is not the latest one. Please upgrade it by referring to HUAWEI AppGallery Connect Guide. To support multiple channels, you need to add the agconnect-services.json file to the folder of only the Huawei channel and ensure that the AppGallery Connect plug-in version in the project is 1.2.1.301 or later (classpath'com.huawei.agconnect:agcp:1.2.1.301'). If the plug-in version is earlier than 1.2.1.301, upgrade it to 1.2.1.301 or later. To obtain the latest AppGallery Connect plug-in version, please refer to Configuring Address Information for the AppGallery Connect SDK.
The configuration procedure is as follows: If your app needs to support multiple build types or flavors, configure the agconnect-services.json configuration file downloaded from AppGallery Connect for your app to implement the function. The agconnect-services.json file provides configuration information required by various services in your AppGalleryConnect project. Therefore, if you need to use multiple flavors to release different app versions, copy the agconnect-services.json file to the folder of each flavor and configure it. To support multiple build types, such as release, debug, rest, and mirror for your app, set buildTypes in the build.gradle file in the app directory. You also need to copy the agconnect-services.json file to the folder of each build type. If your project needs to support different app packages for different channels, the package name needs to vary depending on the channel. Change the package name in productFlavor in the build.gradle file under the app directory.