diff --git a/packages/smooth_app/android/app/build.gradle b/packages/smooth_app/android/app/build.gradle index 4d1eddb3c90..5ae28a77167 100644 --- a/packages/smooth_app/android/app/build.gradle +++ b/packages/smooth_app/android/app/build.gradle @@ -4,35 +4,20 @@ plugins { id "dev.flutter.flutter-gradle-plugin" } -def localProperties = new Properties() -def localPropertiesFile = rootProject.file('local.properties') -if (localPropertiesFile.exists()) { - localPropertiesFile.withReader('UTF-8') { reader -> - localProperties.load(reader) - } -} - -def flutterVersionCode = localProperties.getProperty('flutter.versionCode') -if (flutterVersionCode == null) { - flutterVersionCode = '1' -} - -def flutterVersionName = localProperties.getProperty('flutter.versionName') -if (flutterVersionName == null) { - flutterVersionName = '1.0' -} android { - compileSdkVersion 34 - ndkVersion "25.1.8937393" + namespace = "org.openfoodfacts.app" + compileSdk = flutter.compileSdkVersion + ndkVersion = "27.0.12077973" compileOptions { - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 + sourceCompatibility = JavaVersion.VERSION_17 + targetCompatibility = JavaVersion.VERSION_17 + coreLibraryDesugaringEnabled true } kotlinOptions { - jvmTarget = '1.8' + jvmTarget = JavaVersion.VERSION_17 } sourceSets { @@ -41,10 +26,10 @@ android { defaultConfig { applicationId "org.openfoodfacts.scanner" - minSdkVersion 21 - targetSdkVersion 34 - versionCode flutterVersionCode.toInteger() - versionName flutterVersionName + minSdk = flutter.minSdkVersion + targetSdk = flutter.targetSdkVersion + versionCode = flutter.versionCode + versionName = flutter.versionName multiDexEnabled true } @@ -73,4 +58,5 @@ flutter { dependencies { implementation 'androidx.multidex:multidex:2.0.1' + coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.2.2' } \ No newline at end of file diff --git a/packages/smooth_app/android/app/src/main/AndroidManifest.xml b/packages/smooth_app/android/app/src/main/AndroidManifest.xml index 212f5f042f2..013cabbe812 100644 --- a/packages/smooth_app/android/app/src/main/AndroidManifest.xml +++ b/packages/smooth_app/android/app/src/main/AndroidManifest.xml @@ -1,6 +1,5 @@ diff --git a/packages/smooth_app/android/build.gradle b/packages/smooth_app/android/build.gradle index bc157bd1a12..3b8a5cf6f1b 100644 --- a/packages/smooth_app/android/build.gradle +++ b/packages/smooth_app/android/build.gradle @@ -3,6 +3,27 @@ allprojects { google() mavenCentral() } + + subprojects { + afterEvaluate { + if (it.hasProperty('android')) { + it.android.compileSdkVersion = 35 + it.android.defaultConfig.targetSdkVersion = 35 + it.android.compileOptions.sourceCompatibility = JavaVersion.VERSION_21 + it.android.compileOptions.targetCompatibility = JavaVersion.VERSION_21 + tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).configureEach { + kotlinOptions.jvmTarget = JavaVersion.VERSION_21 + } + if (it.android.namespace == null) { + def manifest = new XmlSlurper().parse(file(it.android.sourceSets.main.manifest.srcFile)) + def packageName = manifest.@package.text() + android.namespace = packageName + println("Updating namespace ${packageName}") + } + } + } + project.buildDir = "${rootProject.buildDir}/${project.name}" + } } rootProject.buildDir = '../build' diff --git a/packages/smooth_app/android/gradle.properties b/packages/smooth_app/android/gradle.properties index 94adc3a3f97..25971708216 100644 --- a/packages/smooth_app/android/gradle.properties +++ b/packages/smooth_app/android/gradle.properties @@ -1,3 +1,3 @@ -org.gradle.jvmargs=-Xmx1536M +org.gradle.jvmargs=-Xmx4G -XX:MaxMetaspaceSize=2G -XX:+HeapDumpOnOutOfMemoryError android.useAndroidX=true android.enableJetifier=true diff --git a/packages/smooth_app/android/gradle/wrapper/gradle-wrapper.properties b/packages/smooth_app/android/gradle/wrapper/gradle-wrapper.properties index 3c472b99c6f..82e606a573c 100644 --- a/packages/smooth_app/android/gradle/wrapper/gradle-wrapper.properties +++ b/packages/smooth_app/android/gradle/wrapper/gradle-wrapper.properties @@ -2,4 +2,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-all.zip + diff --git a/packages/smooth_app/android/settings.gradle b/packages/smooth_app/android/settings.gradle index 05e070bc760..2c926c94841 100644 --- a/packages/smooth_app/android/settings.gradle +++ b/packages/smooth_app/android/settings.gradle @@ -17,9 +17,10 @@ pluginManagement { } plugins { + id "dev.flutter.flutter-plugin-loader" version "1.0.0" - id "com.android.application" version "7.3.0" apply false - id "org.jetbrains.kotlin.android" version "1.8.0" apply false + id "com.android.application" version "8.7.1" apply false + id "org.jetbrains.kotlin.android" version "2.0.20" apply false } -include ":app" \ No newline at end of file +include ":app"