diff --git a/wakelock_plus/android/build.gradle b/wakelock_plus/android/build.gradle index d2a1ffe..b6479c0 100644 --- a/wakelock_plus/android/build.gradle +++ b/wakelock_plus/android/build.gradle @@ -2,7 +2,6 @@ group 'dev.fluttercommunity.plus.wakelock' version '1.0-SNAPSHOT' buildscript { - ext.kotlin_version = '2.2.0' repositories { google() mavenCentral() @@ -21,7 +20,11 @@ rootProject.allprojects { } apply plugin: 'com.android.library' -apply plugin: 'kotlin-android' + +def agpMajor = com.android.Version.ANDROID_GRADLE_PLUGIN_VERSION.tokenize('.')[0] as int +if (agpMajor < 9) { + apply plugin: 'kotlin-android' +} android { namespace 'dev.fluttercommunity.plus.wakelock' @@ -32,9 +35,6 @@ android { targetCompatibility JavaVersion.VERSION_17 } - kotlinOptions { - jvmTarget = '17' - } lintOptions { disable 'InvalidPackage' } @@ -51,7 +51,6 @@ android { } dependencies { - implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" testImplementation 'org.jetbrains.kotlin:kotlin-test' testImplementation 'org.mockito:mockito-core:5.0.0' } @@ -69,3 +68,11 @@ android { } } } + + +kotlin { + compilerOptions { + jvmTarget = org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_17 + } +} + diff --git a/wakelock_plus/example/android/app/build.gradle b/wakelock_plus/example/android/app/build.gradle index c53cd6c..215ca60 100644 --- a/wakelock_plus/example/android/app/build.gradle +++ b/wakelock_plus/example/android/app/build.gradle @@ -1,6 +1,5 @@ plugins { id 'com.android.application' - id 'kotlin-android' id 'dev.flutter.flutter-gradle-plugin' } def localProperties = new Properties() @@ -31,9 +30,6 @@ android { targetCompatibility JavaVersion.VERSION_17 } - kotlinOptions { - jvmTarget = '17' - } sourceSets { main.java.srcDirs += 'src/main/kotlin' @@ -59,6 +55,13 @@ android { } } +kotlin { + compilerOptions { + jvmTarget = org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_17 + } +} + + flutter { source '../..' } diff --git a/wakelock_plus/example/android/gradle.properties b/wakelock_plus/example/android/gradle.properties index bee0af8..6a41485 100644 --- a/wakelock_plus/example/android/gradle.properties +++ b/wakelock_plus/example/android/gradle.properties @@ -1,3 +1,8 @@ org.gradle.jvmargs=-Xmx4g android.useAndroidX=true android.enableJetifier=true + +# This builtInKotlin flag was added automatically by Flutter migrator +android.builtInKotlin=false +# This newDsl flag was added automatically by Flutter migrator +android.newDsl=false diff --git a/wakelock_plus/pubspec.yaml b/wakelock_plus/pubspec.yaml index a555046..45a3b04 100644 --- a/wakelock_plus/pubspec.yaml +++ b/wakelock_plus/pubspec.yaml @@ -1,12 +1,12 @@ name: wakelock_plus -description: >-2 +description: >2- Plugin that allows you to keep the device screen awake, i.e. prevent the screen from sleeping on Android, iOS, macOS, Windows, Linux, and web. version: 1.6.1 repository: https://github.com/fluttercommunity/wakelock_plus/tree/main/wakelock_plus environment: - sdk: '>=3.10.0 <4.0.0' + sdk: ">=3.10.0 <4.0.0" flutter: ">=3.38.0" dependencies: @@ -33,7 +33,7 @@ dev_dependencies: flutter_lints: ^6.0.0 pigeon: ^26.2.3 # dart run pigeon --input "pigeons/messages.dart" mocktail: ^1.0.5 - + # For information on the generic Dart part of this file, see the # following page: https://dart.dev/tools/pub/pubspec @@ -99,4 +99,4 @@ flutter: # https://flutter.dev/custom-fonts/#from-packages assets: - - packages/wakelock_plus/assets/no_sleep.js \ No newline at end of file + - packages/wakelock_plus/assets/no_sleep.js