From 8bec3cf053088b515be7270136c85c17fb0bf120 Mon Sep 17 00:00:00 2001 From: Imran Remtulla Date: Sat, 31 May 2025 03:35:29 -0400 Subject: [PATCH] Update Android-side Gradle stuff + dependencies + upgrade all Flutter packages to latest --- android/app/build.gradle | 105 ----------------- android/app/build.gradle.kts | 107 ++++++++++++++++++ .../dev/imranr/obtainium/MainActivity.kt | 2 +- android/build.gradle | 22 ---- android/build.gradle.kts | 25 ++++ android/gradle.properties | 2 +- .../gradle/wrapper/gradle-wrapper.properties | 2 +- android/settings.gradle | 25 ---- android/settings.gradle.kts | 25 ++++ pubspec.lock | 70 +----------- pubspec.yaml | 59 +++++----- 11 files changed, 190 insertions(+), 254 deletions(-) delete mode 100644 android/app/build.gradle create mode 100644 android/app/build.gradle.kts delete mode 100644 android/build.gradle create mode 100644 android/build.gradle.kts delete mode 100644 android/settings.gradle create mode 100644 android/settings.gradle.kts diff --git a/android/app/build.gradle b/android/app/build.gradle deleted file mode 100644 index d6c5d7b..0000000 --- a/android/app/build.gradle +++ /dev/null @@ -1,105 +0,0 @@ -plugins { - id "com.android.application" - id "kotlin-android" - // The Flutter Gradle Plugin must be applied after the Android and Kotlin Gradle 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' -} - -def keystoreProperties = new Properties() -def keystorePropertiesFile = rootProject.file('key.properties') -if (keystorePropertiesFile.exists()) { - keystoreProperties.load(new FileInputStream(keystorePropertiesFile)) -} - -android { - namespace = "dev.imranr.obtainium" - compileSdk = flutter.compileSdkVersion - ndkVersion = flutter.ndkVersion - - compileOptions { - sourceCompatibility = JavaVersion.VERSION_1_8 - targetCompatibility = JavaVersion.VERSION_1_8 - } - - kotlinOptions { - jvmTarget = JavaVersion.VERSION_1_8 - } - - defaultConfig { - // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). - applicationId = "dev.imranr.obtainium" - // You can update the following values to match your application needs. - // For more information, see: https://flutter.dev/to/review-gradle-config. - minSdk = 24 - targetSdk = flutter.targetSdkVersion - versionCode = flutter.versionCode - versionName = flutter.versionName - } - - flavorDimensions "flavor" - - productFlavors { - normal { - dimension "flavor" - applicationIdSuffix "" - } - fdroid { - dimension "flavor" - applicationIdSuffix ".fdroid" - } - } - - signingConfigs { - release { - keyAlias keystoreProperties['keyAlias'] - keyPassword keystoreProperties['keyPassword'] - storeFile keystoreProperties['storeFile'] ? file(keystoreProperties['storeFile']) : null - storePassword keystoreProperties['storePassword'] - } - } - - buildTypes { - release { - signingConfig signingConfigs.release - } - debug { - applicationIdSuffix = ".debug" - versionNameSuffix = "-debug" - } - } -} - -flutter { - source = "../.." -} - -ext.abiCodes = ["x86_64": 1, "armeabi-v7a": 2, "arm64-v8a": 3] -import com.android.build.OutputFile -android.applicationVariants.all { variant -> - variant.outputs.each { output -> - def abiVersionCode = project.ext.abiCodes.get(output.getFilter(OutputFile.ABI)) - if (abiVersionCode != null) { - output.versionCodeOverride = variant.versionCode * 10 + abiVersionCode - } else { - output.versionCodeOverride = variant.versionCode * 10 - } - } -} \ No newline at end of file diff --git a/android/app/build.gradle.kts b/android/app/build.gradle.kts new file mode 100644 index 0000000..b144dc3 --- /dev/null +++ b/android/app/build.gradle.kts @@ -0,0 +1,107 @@ +import java.io.FileInputStream +import java.util.Properties +import com.android.build.api.variant.FilterConfiguration.FilterType.* + +plugins { + id("com.android.application") + id("kotlin-android") + // The Flutter Gradle Plugin must be applied after the Android and Kotlin Gradle plugins. + id("dev.flutter.flutter-gradle-plugin") +} + +val localProperties = Properties() +val localPropertiesFile = rootProject.file("local.properties") +if (localPropertiesFile.exists()) { + localPropertiesFile.reader(Charsets.UTF_8).use { reader -> + localProperties.load(reader) + } +} + +var flutterVersionCode = localProperties.getProperty("flutter.versionCode") ?: "1" +var flutterVersionName = localProperties.getProperty("flutter.versionName") ?: "1.0" + +val keystoreProperties = Properties() +val keystorePropertiesFile = rootProject.file("key.properties") +if (keystorePropertiesFile.exists()) { + keystoreProperties.load(FileInputStream(keystorePropertiesFile)) +} + +android { + namespace = "dev.imranr.obtainium" + compileSdk = flutter.compileSdkVersion + ndkVersion = flutter.ndkVersion + + compileOptions { + isCoreLibraryDesugaringEnabled = true + sourceCompatibility = JavaVersion.VERSION_11 + targetCompatibility = JavaVersion.VERSION_11 + } + + kotlinOptions { + jvmTarget = JavaVersion.VERSION_11.toString() + } + + defaultConfig { + applicationId = "dev.imranr.obtainium" + // You can update the following values to match your application needs. + // For more information, see: https://flutter.dev/to/review-gradle-config. + minSdk = 24 + targetSdk = flutter.targetSdkVersion + versionCode = flutterVersionCode.toInt() + versionName = flutterVersionName + } + + flavorDimensions("flavor") + + productFlavors { + create("normal") { + dimension = "flavor" + applicationIdSuffix = "" + } + create("fdroid") { + dimension = "flavor" + applicationIdSuffix = ".fdroid" + } + } + + signingConfigs { + create("release") { + keyAlias = keystoreProperties["keyAlias"].toString() + keyPassword = keystoreProperties["keyPassword"].toString() + storeFile = keystoreProperties["storeFile"]?.let { file(it) } + storePassword = keystoreProperties["storePassword"].toString() + } + } + + buildTypes { + getByName("release") { + signingConfig = signingConfigs.getByName("release") + } + getByName("debug") { + applicationIdSuffix = ".debug" + versionNameSuffix = "-debug" + } + } +} + +val abiCodes = mapOf("x86_64" to 1, "armeabi-v7a" to 2, "arm64-v8a" to 3) + +androidComponents { + onVariants { variant -> + variant.outputs.forEach { output -> + val name = output.filters.find { it.filterType == ABI }?.identifier + val baseAbiCode = abiCodes[name] + if (baseAbiCode != null) { + output.versionCode.set(baseAbiCode + ((output.versionCode.get() ?: 0) * 10)) + } + } + } +} + +dependencies { + coreLibraryDesugaring("com.android.tools:desugar_jdk_libs:2.1.5") +} + +flutter { + source = "../.." +} diff --git a/android/app/src/main/kotlin/dev/imranr/obtainium/MainActivity.kt b/android/app/src/main/kotlin/dev/imranr/obtainium/MainActivity.kt index 09cd313..71920ac 100644 --- a/android/app/src/main/kotlin/dev/imranr/obtainium/MainActivity.kt +++ b/android/app/src/main/kotlin/dev/imranr/obtainium/MainActivity.kt @@ -2,4 +2,4 @@ package dev.imranr.obtainium import io.flutter.embedding.android.FlutterActivity -class MainActivity: FlutterActivity() +class MainActivity : FlutterActivity() diff --git a/android/build.gradle b/android/build.gradle deleted file mode 100644 index b3f11e5..0000000 --- a/android/build.gradle +++ /dev/null @@ -1,22 +0,0 @@ -allprojects { - repositories { - google() - mavenCentral() - maven { - // [required] background_fetch - url "${project(':background_fetch').projectDir}/libs" - } - } -} - -rootProject.buildDir = "../build" -subprojects { - project.buildDir = "${rootProject.buildDir}/${project.name}" -} -subprojects { - project.evaluationDependsOn(":app") -} - -tasks.register("clean", Delete) { - delete rootProject.buildDir -} diff --git a/android/build.gradle.kts b/android/build.gradle.kts new file mode 100644 index 0000000..72266b6 --- /dev/null +++ b/android/build.gradle.kts @@ -0,0 +1,25 @@ +allprojects { + repositories { + google() + mavenCentral() + maven { + // [required] background_fetch + url = uri("${project(":background_fetch").projectDir}/libs") + } + } +} + +val newBuildDir: Directory = rootProject.layout.buildDirectory.dir("../../build").get() +rootProject.layout.buildDirectory.value(newBuildDir) + +subprojects { + val newSubprojectBuildDir: Directory = newBuildDir.dir(project.name) + project.layout.buildDirectory.value(newSubprojectBuildDir) +} +subprojects { + project.evaluationDependsOn(":app") +} + +tasks.register("clean") { + delete(rootProject.layout.buildDirectory) +} diff --git a/android/gradle.properties b/android/gradle.properties index 2597170..f018a61 100644 --- a/android/gradle.properties +++ b/android/gradle.properties @@ -1,3 +1,3 @@ -org.gradle.jvmargs=-Xmx4G -XX:MaxMetaspaceSize=2G -XX:+HeapDumpOnOutOfMemoryError +org.gradle.jvmargs=-Xmx8G -XX:MaxMetaspaceSize=4G -XX:ReservedCodeCacheSize=512m -XX:+HeapDumpOnOutOfMemoryError android.useAndroidX=true android.enableJetifier=true diff --git a/android/gradle/wrapper/gradle-wrapper.properties b/android/gradle/wrapper/gradle-wrapper.properties index 7bb2df6..ac3b479 100644 --- a/android/gradle/wrapper/gradle-wrapper.properties +++ b/android/gradle/wrapper/gradle-wrapper.properties @@ -2,4 +2,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.12-all.zip diff --git a/android/settings.gradle b/android/settings.gradle deleted file mode 100644 index 4aa0f8d..0000000 --- a/android/settings.gradle +++ /dev/null @@ -1,25 +0,0 @@ -pluginManagement { - def flutterSdkPath = { - def properties = new Properties() - file("local.properties").withInputStream { properties.load(it) } - def flutterSdkPath = properties.getProperty("flutter.sdk") - assert flutterSdkPath != null, "flutter.sdk not set in local.properties" - return flutterSdkPath - }() - - includeBuild("$flutterSdkPath/packages/flutter_tools/gradle") - - repositories { - google() - mavenCentral() - gradlePluginPortal() - } -} - -plugins { - id "dev.flutter.flutter-plugin-loader" version "1.0.0" - id "com.android.application" version "8.1.0" apply false - id "org.jetbrains.kotlin.android" version "2.1.21" apply false -} - -include ":app" diff --git a/android/settings.gradle.kts b/android/settings.gradle.kts new file mode 100644 index 0000000..ab39a10 --- /dev/null +++ b/android/settings.gradle.kts @@ -0,0 +1,25 @@ +pluginManagement { + val flutterSdkPath = run { + val properties = java.util.Properties() + file("local.properties").inputStream().use { properties.load(it) } + val flutterSdkPath = properties.getProperty("flutter.sdk") + require(flutterSdkPath != null) { "flutter.sdk not set in local.properties" } + flutterSdkPath + } + + includeBuild("$flutterSdkPath/packages/flutter_tools/gradle") + + repositories { + google() + mavenCentral() + gradlePluginPortal() + } +} + +plugins { + id("dev.flutter.flutter-plugin-loader") version "1.0.0" + id("com.android.application") version "8.7.3" apply false + id("org.jetbrains.kotlin.android") version "2.1.0" apply false +} + +include(":app") diff --git a/pubspec.lock b/pubspec.lock index 32a9665..2980b59 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -76,14 +76,6 @@ packages: url: "https://pub.dev" source: hosted version: "1.0.4" - archive: - dependency: transitive - description: - name: archive - sha256: "2fde1607386ab523f7a36bb3e7edb43bd58e6edaf2ffb29d8a6d578b297fdbbd" - url: "https://pub.dev" - source: hosted - version: "4.0.7" args: dependency: transitive description: @@ -148,22 +140,6 @@ packages: url: "https://pub.dev" source: hosted version: "1.4.0" - checked_yaml: - dependency: transitive - description: - name: checked_yaml - sha256: feb6bed21949061731a7a75fc5d2aa727cf160b91af9a3e464c5e3a32e28b5ff - url: "https://pub.dev" - source: hosted - version: "2.0.3" - cli_util: - dependency: transitive - description: - name: cli_util - sha256: ff6785f7e9e3c38ac98b2fb035701789de90154024a75b6cb926445e83197d1c - url: "https://pub.dev" - source: hosted - version: "0.4.2" clock: dependency: transitive description: @@ -449,16 +425,8 @@ packages: url: "https://pub.dev" source: hosted version: "1.0.0" - flutter_launcher_icons: - dependency: "direct dev" - description: - name: flutter_launcher_icons - sha256: bfa04787c85d80ecb3f8777bde5fc10c3de809240c48fa061a2c2bf15ea5211c - url: "https://pub.dev" - source: hosted - version: "0.14.3" flutter_lints: - dependency: "direct dev" + dependency: "direct main" description: name: flutter_lints sha256: "3105dc8492f6183fb076ccf1f351ac3d60564bff92e20bfc4af9cc1651f4e7e1" @@ -511,7 +479,7 @@ packages: source: hosted version: "2.0.28" flutter_test: - dependency: "direct dev" + dependency: transitive description: flutter source: sdk version: "0.0.0" @@ -584,14 +552,6 @@ packages: url: "https://pub.dev" source: hosted version: "4.1.2" - image: - dependency: transitive - description: - name: image - sha256: "4e973fcf4caae1a4be2fa0a13157aa38a8f9cb049db6529aa00b4d71abc4d928" - url: "https://pub.dev" - source: hosted - version: "4.5.4" intl: dependency: transitive description: @@ -600,14 +560,6 @@ packages: url: "https://pub.dev" source: hosted version: "0.20.2" - json_annotation: - dependency: transitive - description: - name: json_annotation - sha256: "1ce844379ca14835a50d2f019a3099f419082cfdd231cd86a142af94dd5c6bb1" - url: "https://pub.dev" - source: hosted - version: "4.9.0" leak_tracker: dependency: transitive description: @@ -856,14 +808,6 @@ packages: url: "https://pub.dev" source: hosted version: "0.10.2+1" - posix: - dependency: transitive - description: - name: posix - sha256: f0d7856b6ca1887cfa6d1d394056a296ae33489db914e365e2044fdada449e62 - url: "https://pub.dev" - source: hosted - version: "6.0.2" provider: dependency: "direct main" description: @@ -1255,14 +1199,6 @@ packages: url: "https://pub.dev" source: hosted version: "6.3.0" - yaml: - dependency: transitive - description: - name: yaml - sha256: b9da305ac7c39faa3f030eccd175340f968459dae4af175130b3fc47e40d76ce - url: "https://pub.dev" - source: hosted - version: "3.1.3" sdks: - dart: ">=3.8.0 <4.0.0" + dart: ">=3.8.1 <4.0.0" flutter: ">=3.27.0" diff --git a/pubspec.yaml b/pubspec.yaml index ce25144..ed9261e 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -19,7 +19,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev version: 1.1.56+2313 environment: - sdk: ^3.6.0 + sdk: ^3.8.1 # Dependencies specify other packages that your package needs in order to work. # To automatically upgrade your package dependencies to the latest versions @@ -33,22 +33,22 @@ dependencies: # The following adds the Cupertino Icons font to your application. # Use with the CupertinoIcons class for iOS style icons. - cupertino_icons: ^1.0.5 - path_provider: ^2.0.11 + cupertino_icons: ^1.0.8 + path_provider: ^2.1.5 flutter_fgbg: ^0.7.1 - flutter_local_notifications: ^18.0.0 - provider: ^6.0.3 - http: ^1.0.0 - webview_flutter: ^4.0.0 - dynamic_color: ^1.5.4 - html: ^0.15.0 - shared_preferences: ^2.0.15 - url_launcher: ^6.1.5 + flutter_local_notifications: ^18.0.1 + provider: ^6.1.5 + http: ^1.4.0 + webview_flutter: ^4.13.0 + dynamic_color: ^1.7.0 + html: ^0.15.6 + shared_preferences: ^2.5.3 + url_launcher: ^6.3.1 permission_handler: ^12.0.0+1 - fluttertoast: ^8.0.9 - device_info_plus: ^11.0.0 - file_picker: ^10.0.0 - animations: ^2.0.4 + fluttertoast: ^8.2.12 + device_info_plus: ^11.4.0 + file_picker: ^10.1.9 + animations: ^2.0.11 android_package_installer: # TODO: See if PR will be accepted (dev may not be active), else remove this comment git: url: https://github.com/ImranR98/android_package_installer @@ -58,23 +58,23 @@ dependencies: url: https://github.com/ImranR98/android_package_manager ref: master share_plus: ^11.0.0 - sqflite: ^2.2.0+3 - easy_localization: ^3.0.1 - android_intent_plus: ^5.0.1 - flutter_markdown: ^0.7.1 - flutter_archive: ^6.0.0 + sqflite: ^2.4.2 + easy_localization: ^3.0.7+1 + android_intent_plus: ^5.3.0 + flutter_markdown: ^0.7.7+1 + flutter_archive: ^6.0.3 hsluv: ^1.1.3 - connectivity_plus: ^6.0.1 + connectivity_plus: ^6.1.4 shared_storage: # TODO: Is this maintained? git: url: https://github.com/AlexBacich/shared-storage ref: master - crypto: ^3.0.3 + crypto: ^3.0.6 bcrypt: ^1.1.3 - app_links: ^6.0.1 - background_fetch: ^1.2.1 + app_links: ^6.4.0 + background_fetch: ^1.3.8 equations: ^5.0.2 - flex_color_picker: ^3.4.1 + flex_color_picker: ^3.7.1 android_system_font: git: url: https://github.com/re7gog/android_system_font @@ -83,15 +83,10 @@ dependencies: git: url: https://github.com/wilver06w/shizuku_apk_installer ref: master - - markdown: any + markdown: ^7.3.0 flutter_typeahead: ^5.2.0 - battery_plus: ^6.1.0 + battery_plus: ^6.2.1 flutter_charset_detector: ^5.0.0 -dev_dependencies: - flutter_test: - sdk: flutter - flutter_launcher_icons: ^0.14.1 # The "flutter_lints" package below contains a set of recommended lints to # encourage good coding practices. The lint set provided by the package is