diff --git a/android/app/build.gradle b/android/app/build.gradle index 6729a1c82..6ffdbec3c 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -1,6 +1,5 @@ plugins { id 'com.android.application' - id 'com.huawei.agconnect' id 'kotlin-android' id 'kotlin-kapt' } @@ -82,6 +81,7 @@ android { // Google Play dimension "store" ext.useCrashlytics = true + ext.useHMS = false // generate a universal APK without x86 native libs ext.useNdkAbiFilters = true } @@ -90,6 +90,7 @@ android { // Huawei AppGallery dimension "store" ext.useCrashlytics = false + ext.useHMS = true // generate a universal APK without x86 native libs ext.useNdkAbiFilters = true } @@ -100,6 +101,7 @@ android { // cf https://android.izzysoft.de/articles/named/app-modules-2 dimension "store" ext.useCrashlytics = false + ext.useHMS = false // generate APK by ABI, but NDK ABI filters are incompatible with split APK generation ext.useNdkAbiFilters = false } @@ -162,7 +164,9 @@ dependencies { // forked, built by JitPack, cf https://jitpack.io/p/deckerst/pixymeta-android implementation 'com.github.deckerst:pixymeta-android:706bd73d6e' implementation 'com.github.bumptech.glide:glide:4.13.2' - implementation 'com.huawei.agconnect:agconnect-core:1.5.2.300' + + // huawei flavor only + huaweiImplementation 'com.huawei.agconnect:agconnect-core:1.5.2.300' kapt 'androidx.annotation:annotation:1.3.0' kapt 'com.github.bumptech.glide:compiler:4.13.0' @@ -177,4 +181,8 @@ android.productFlavors.each { flavor -> apply plugin: 'com.google.gms.google-services' apply plugin: 'com.google.firebase.crashlytics' } + if (tasks.contains(flavor.name) && flavor.ext.useHMS) { + println("Building flavor with HMS [${flavor.name}] - applying plugin") + apply plugin: 'com.huawei.agconnect' + } } diff --git a/android/build.gradle b/android/build.gradle index 8701470a4..6ba7c8335 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -9,10 +9,10 @@ buildscript { dependencies { classpath 'com.android.tools.build:gradle:7.1.3' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" - // GMS & Firebase Crashlytics are not actually used by all flavors + // GMS & Firebase Crashlytics (used by some flavors only) classpath 'com.google.gms:google-services:4.3.10' classpath 'com.google.firebase:firebase-crashlytics-gradle:2.8.1' - // HMS + // HMS (used by some flavors only) classpath 'com.huawei.agconnect:agcp:1.5.2.300' } }