From 006fb4bd45325dc829d70eb0eab291a542dcc17e Mon Sep 17 00:00:00 2001 From: okmsbun Date: Sun, 31 May 2026 17:15:28 +0300 Subject: [PATCH 1/3] Refactor Kotlin plugin application logic based on Android Gradle Plugin version --- android/build.gradle | 29 +++++++++++++++++++++++++---- 1 file changed, 25 insertions(+), 4 deletions(-) diff --git a/android/build.gradle b/android/build.gradle index 740f7b9..846ac59 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -22,7 +22,18 @@ allprojects { } apply plugin: "com.android.library" -apply plugin: "kotlin-android" + +def agpMajor = com.android.Version.ANDROID_GRADLE_PLUGIN_VERSION.tokenize(".")[0] as int +def builtInKotlinEnabled = providers.gradleProperty("android.builtInKotlin") + .map { it.toBoolean() } + .orElse(agpMajor >= 9) + .get() + +def shouldApplyKotlinAndroid = agpMajor < 9 || !builtInKotlinEnabled + +if (shouldApplyKotlinAndroid) { + apply plugin: "kotlin-android" +} android { namespace = "com.okmsbun.flutter_device_apps_android" @@ -34,8 +45,10 @@ android { targetCompatibility = JavaVersion.VERSION_11 } - kotlinOptions { - jvmTarget = JavaVersion.VERSION_11 + if (shouldApplyKotlinAndroid) { + kotlinOptions { + jvmTarget = JavaVersion.VERSION_11.toString() + } } sourceSets { @@ -60,10 +73,18 @@ android { all { testLogging { events "passed", "skipped", "failed", "standardOut", "standardError" - outputs.upToDateWhen {false} + outputs.upToDateWhen { false } showStandardStreams = true } } } } } + +if (!shouldApplyKotlinAndroid) { + kotlin { + compilerOptions { + jvmTarget = org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_11 + } + } +} \ No newline at end of file From 840d67b48d298f091c14c2cd359e4f1b9af10fea Mon Sep 17 00:00:00 2001 From: okmsbun Date: Sun, 31 May 2026 17:15:34 +0300 Subject: [PATCH 2/3] Update changelog for version 0.8.0 to include Android Gradle Plugin 9 compatibility --- CHANGELOG.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 387b54f..534c3aa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,9 +1,16 @@ +## 0.8.0 + +- Adds Android Gradle Plugin 9 / built-in Kotlin compatibility. +- Keeps Kotlin Gradle Plugin compatibility for Android Gradle Plugin versions earlier than 9. + ## 0.7.0 + - Expanded Android app details payload with additional raw fields: `uid`, `apkPath`, `apkSizeBytes`, `dataPath`, and `isOnExternalStorage`. - Added APK size calculation in bytes using `ApplicationInfo.sourceDir` and `splitSourceDirs`. - Updated Dart unit tests for method channel mapping of the new fields. ## 0.6.0 + - **BREAKING**: Updated to match platform interface 0.6.0 - `requestedPermissions` removed from `AppInfo` - Added `getRequestedPermissions(String packageName)` method implementation for on-demand permission retrieval - Added GitHub Actions workflows for Android unit tests, quality checks, and PR enforcement @@ -12,13 +19,16 @@ - Made `FlutterDeviceAppsAndroidPlugin` class `open` with `protected` fields for testability ## 0.5.1 + - Added support for additional `AppInfo` fields from the Android package manager: `category`, `targetSdkVersion`, `minSdkVersion`, `enabled`, `processName`, `installLocation`, `requestedPermissions`. - Populates `requestedPermissions` via `PackageManager.GET_PERMISSIONS`. ## 0.4.0 + App change events now forward the raw Android action string to Dart, letting the Dart side handle event type mapping; no breaking changes. ## 0.2.0 + - Enhanced README.md with professional badge layout for better package visibility - Added centered HTML badges for pub.dev, GitHub stars, Flutter documentation, and MIT license - Added umbrella package badge linking to main flutter_device_apps package @@ -27,6 +37,7 @@ App change events now forward the raw Android action string to Dart, letting the - Enhanced package branding and visual consistency across federated plugin family ## 0.1.2 + - Added `openAppSettings` implementation using `Settings.ACTION_APPLICATION_DETAILS_SETTINGS` - Added `uninstallApp` implementation using `Intent.ACTION_UNINSTALL_PACKAGE` with fallback to `ACTION_DELETE` - Added `getInstallerStore` implementation using `PackageManager.getInstallerPackageName()` @@ -42,5 +53,6 @@ App change events now forward the raw Android action string to Dart, letting the - Removed unused `enabled`/`disabled` event types that were never implemented ## 0.1.0 + - First public Android implementation for `flutter_device_apps` - Adds listApps, getApp, openApp, and appChanges (EventChannel) From 2778824c80090cc4b408efe95f61da8832e7bdcf Mon Sep 17 00:00:00 2001 From: okmsbun Date: Sun, 31 May 2026 17:15:39 +0300 Subject: [PATCH 3/3] Bump version to 0.8.0 in pubspec.yaml --- pubspec.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pubspec.yaml b/pubspec.yaml index 91928fe..fb85b27 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: flutter_device_apps_android description: Android implementation of flutter_device_apps (federated plugin). -version: 0.7.0 +version: 0.8.0 repository: https://github.com/okmsbun/flutter_device_apps_android issue_tracker: https://github.com/okmsbun/flutter_device_apps_android/issues topics: