fixed HMS dependency in non-huawei flavor

This commit is contained in:
Thibault Deckers 2022-05-12 15:15:10 +09:00
parent 3db806eabe
commit 754b155576
2 changed files with 12 additions and 4 deletions

View file

@ -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'
}
}

View file

@ -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'
}
}