buildscript { repositories { google() mavenCentral() maven { url 'https://developer.huawei.com/repo/' } } dependencies { classpath 'com.android.tools.build:gradle:7.3.0' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.7.10" classpath 'com.google.gms:google-services:4.3.15' classpath 'com.huawei.agconnect:agcp:1.9.1.304' } } allprojects { repositories { google() mavenCentral() maven { url 'https://developer.huawei.com/repo/' } } // Exclude old BouncyCastle globally to avoid duplicate classes configurations.all { exclude group: 'org.bouncycastle', module: 'bcprov-jdk16' } tasks.withType(JavaCompile).configureEach { sourceCompatibility = JavaVersion.VERSION_21 targetCompatibility = JavaVersion.VERSION_21 } tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).configureEach { kotlinOptions { jvmTarget = "21" } } subprojects { afterEvaluate { project -> if (project.hasProperty('android')) { project.android { if (namespace == null) { namespace project.group } buildFeatures { if (buildConfig == null) { buildConfig true } } compileOptions { sourceCompatibility JavaVersion.VERSION_21 targetCompatibility JavaVersion.VERSION_21 } } } // Force Java 17 for all JavaCompile tasks in all subprojects (including plugins) project.tasks.withType(JavaCompile).configureEach { sourceCompatibility = JavaVersion.VERSION_21 targetCompatibility = JavaVersion.VERSION_21 } // Force Kotlin JVM target for all subprojects project.tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).configureEach { kotlinOptions { jvmTarget = "21" } } if (project.name == 'nfc_manager') { project.tasks.matching { it.name.startsWith("compile") && it.name.endsWith("Kotlin") }.configureEach { doFirst { def translatorFile = project.file("src/main/kotlin/io/flutter/plugins/nfcmanager/Translator.kt") if (translatorFile.exists()) { def content = translatorFile.text if (content.contains("toLowerCase(Locale.ROOT)")) { translatorFile.text = content.replace("toLowerCase(Locale.ROOT)", "lowercase(Locale.ROOT)") } } } } } } } } rootProject.buildDir = '../build' subprojects { project.buildDir = "${rootProject.buildDir}/${project.name}" } subprojects { project.evaluationDependsOn(':app') } tasks.register("clean", Delete) { delete rootProject.layout.buildDirectory }