diff --git a/android/app/build.gradle b/android/app/build.gradle index 3cd182967..c0cd0cfbf 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -80,8 +80,6 @@ android { play { // Google Play dimension "store" - ext.useCrashlytics = true - ext.useHMS = false // generate a universal APK without x86 native libs ext.useNdkAbiFilters = true } @@ -89,8 +87,6 @@ android { huawei { // Huawei AppGallery dimension "store" - ext.useCrashlytics = false - ext.useHMS = true // generate a universal APK without x86 native libs ext.useNdkAbiFilters = true } @@ -100,20 +96,18 @@ android { // check offending libraries with `scanapk` // 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 } libre { // F-Droid - applicationIdSuffix ".libre" + // check offending libraries with `fdroidserver` + // cf https://f-droid.org/en/docs/Submitting_to_F-Droid_Quick_Start_Guide/ dimension "store" - ext.useCrashlytics = false - ext.useHMS = false // generate a universal APK without x86 native libs ext.useNdkAbiFilters = true + applicationIdSuffix ".libre" } } @@ -150,6 +144,7 @@ android { } } } + lint { disable 'InvalidPackage' } @@ -208,15 +203,13 @@ dependencies { compileOnly rootProject.findProject(':streams_channel') } -android.productFlavors.each { flavor -> - def tasks = gradle.startParameter.taskRequests.toString().toLowerCase() - if (tasks.contains(flavor.name) && flavor.ext.useCrashlytics) { - println("Building flavor [${flavor.name}] with Crashlytics plugin") - apply plugin: 'com.google.gms.google-services' - apply plugin: 'com.google.firebase.crashlytics' - } - if (tasks.contains(flavor.name) && flavor.ext.useHMS) { - println("Building flavor [${flavor.name}] with HMS plugin") - apply plugin: 'com.huawei.agconnect' - } +if (useCrashlytics) { + println("Building flavor with Crashlytics plugin") + apply plugin: 'com.google.gms.google-services' + apply plugin: 'com.google.firebase.crashlytics' } + +if (useHms) { + println("Building flavor with HMS plugin") + apply plugin: 'com.huawei.agconnect' +} \ No newline at end of file diff --git a/android/build.gradle b/android/build.gradle index ccac79951..d1da67889 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -1,20 +1,35 @@ // Top-level build file where you can add configuration options common to all sub-projects/modules. buildscript { ext.kotlin_version = '1.7.20' + + ext.useCrashlytics = gradle.startParameter.taskNames.any { task -> task.containsIgnoreCase("play") } + ext.useHms = gradle.startParameter.taskNames.any { task -> task.containsIgnoreCase("huawei") } + repositories { google() mavenCentral() - maven { url 'https://developer.huawei.com/repo/' } + + if (useHms) { + // HMS (used by some flavors only) + maven { url 'https://developer.huawei.com/repo/' } + } } + dependencies { // TODO TLAD upgrade Android Gradle plugin >=7.3 when this is fixed: https://github.com/flutter/flutter/issues/115100 classpath 'com.android.tools.build:gradle:7.2.2' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" - // GMS & Firebase Crashlytics (used by some flavors only) - classpath 'com.google.gms:google-services:4.3.14' - classpath 'com.google.firebase:firebase-crashlytics-gradle:2.9.2' - // HMS (used by some flavors only) - classpath 'com.huawei.agconnect:agcp:1.7.2.300' + + if (useCrashlytics) { + // GMS & Firebase Crashlytics (used by some flavors only) + classpath 'com.google.gms:google-services:4.3.14' + classpath 'com.google.firebase:firebase-crashlytics-gradle:2.9.2' + } + + if (useHms) { + // HMS (used by some flavors only) + classpath 'com.huawei.agconnect:agcp:1.7.2.300' + } } } @@ -22,8 +37,13 @@ allprojects { repositories { google() mavenCentral() - maven { url 'https://developer.huawei.com/repo/' } + + if (useHms) { + // HMS (used by some flavors only) + maven { url 'https://developer.huawei.com/repo/' } + } } + // gradle.projectsEvaluated { // tasks.withType(JavaCompile) { // options.compilerArgs << "-Xlint:unchecked" << "-Xlint:deprecation" diff --git a/pubspec.lock b/pubspec.lock index c04b7fd6f..41c7e7868 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -14,7 +14,7 @@ packages: name: _flutterfire_internals url: "https://pub.dartlang.org" source: hosted - version: "1.0.8" + version: "1.0.9" analyzer: dependency: transitive description: @@ -133,14 +133,14 @@ packages: name: cloud_firestore_platform_interface url: "https://pub.dartlang.org" source: hosted - version: "5.8.5" + version: "5.9.0" cloud_firestore_web: dependency: transitive description: name: cloud_firestore_web url: "https://pub.dartlang.org" source: hosted - version: "3.0.5" + version: "3.1.0" collection: dependency: "direct main" description: @@ -291,7 +291,7 @@ packages: name: firebase_core url: "https://pub.dartlang.org" source: hosted - version: "2.2.0" + version: "2.3.0" firebase_core_platform_interface: dependency: transitive description: @@ -312,14 +312,14 @@ packages: name: firebase_crashlytics url: "https://pub.dartlang.org" source: hosted - version: "3.0.5" + version: "3.0.6" firebase_crashlytics_platform_interface: dependency: transitive description: name: firebase_crashlytics_platform_interface url: "https://pub.dartlang.org" source: hosted - version: "3.3.6" + version: "3.3.7" flex_color_picker: dependency: "direct main" description: