diff --git a/android/build.gradle b/android/build.gradle index 3b931050..ef43f197 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -2,14 +2,14 @@ group 'com.github.florent37.assets_audio_player' version '1.0-SNAPSHOT' buildscript { - ext.kotlin_version = '1.7.21' + ext.kotlin_version = '1.9.25' repositories { google() mavenCentral() } dependencies { - classpath 'com.android.tools.build:gradle:8.2.2' + classpath 'com.android.tools.build:gradle:8.7.3' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" } } @@ -25,7 +25,7 @@ apply plugin: 'com.android.library' apply plugin: 'kotlin-android' android { - compileSdk 34 + compileSdk 35 if (project.android.hasProperty("namespace")) { namespace 'com.github.florent37.assets_audio_player' @@ -45,22 +45,22 @@ android { exclude "DebugProbesKt.bin" } compileOptions { - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 + sourceCompatibility JavaVersion.VERSION_17 + targetCompatibility JavaVersion.VERSION_17 } kotlinOptions { - jvmTarget = '1.8' + jvmTarget = '17' } } dependencies { - def coroutinesVersion = '1.6.4' + def coroutinesVersion = '1.7.3' implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" implementation "androidx.multidex:multidex:2.0.1" implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$coroutinesVersion" - implementation 'androidx.annotation:annotation:1.5.0' + implementation 'androidx.annotation:annotation:1.8.2' def exoPlayerVersion = '2.18.1' @@ -70,5 +70,5 @@ dependencies { implementation "com.google.android.exoplayer:exoplayer-smoothstreaming:$exoPlayerVersion" implementation 'com.github.bumptech.glide:glide:4.14.2' annotationProcessor 'com.github.bumptech.glide:compiler:4.14.2' - implementation 'androidx.media:media:1.6.0' + implementation 'androidx.media:media:1.7.0' } diff --git a/android/gradle/wrapper/gradle-wrapper.properties b/android/gradle/wrapper/gradle-wrapper.properties index eeba63f3..c650824a 100644 --- a/android/gradle/wrapper/gradle-wrapper.properties +++ b/android/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ #Fri Nov 04 15:39:06 CET 2022 distributionBase=GRADLE_USER_HOME -distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.11.1-bin.zip distributionPath=wrapper/dists zipStorePath=wrapper/dists zipStoreBase=GRADLE_USER_HOME diff --git a/android/src/main/kotlin/com/github/florent37/assets_audio_player/stopwhencall/HeadsetManager.kt b/android/src/main/kotlin/com/github/florent37/assets_audio_player/stopwhencall/HeadsetManager.kt index f44153f9..cd021ba7 100644 --- a/android/src/main/kotlin/com/github/florent37/assets_audio_player/stopwhencall/HeadsetManager.kt +++ b/android/src/main/kotlin/com/github/florent37/assets_audio_player/stopwhencall/HeadsetManager.kt @@ -90,7 +90,7 @@ class HeadsetManager(private val context: Context) { fun Context.hasPermissionBluetooth() : Boolean { try { val packageInfo = this.packageManager.getPackageInfo(packageName, PackageManager.GET_PERMISSIONS) - return packageInfo.requestedPermissions.contains("android.permission.BLUETOOTH") + return packageInfo.requestedPermissions?.contains("android.permission.BLUETOOTH") ?: false } catch (t: Throwable) { } diff --git a/example/android/app/build.gradle b/example/android/app/build.gradle index 624d4815..8f49f3e2 100644 --- a/example/android/app/build.gradle +++ b/example/android/app/build.gradle @@ -1,3 +1,9 @@ +plugins { + id "com.android.application" + id "kotlin-android" + id "dev.flutter.flutter-gradle-plugin" +} + def localProperties = new Properties() def localPropertiesFile = rootProject.file('local.properties') if (localPropertiesFile.exists()) { @@ -21,44 +27,36 @@ if (flutterVersionName == null) { flutterVersionName = '1.0' } -apply plugin: 'com.android.application' -apply plugin: 'kotlin-android' -apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" - android { - if (project.android.hasProperty("namespace")) { - namespace 'com.github.florent37.example' + namespace 'com.github.florent37.example' + compileSdk 35 + + compileOptions { + sourceCompatibility JavaVersion.VERSION_17 + targetCompatibility JavaVersion.VERSION_17 } - compileSdk 34 + kotlinOptions { + jvmTarget = '17' + } sourceSets { main.java.srcDirs += 'src/main/kotlin' } - lintOptions { - disable 'InvalidPackage' - } - defaultConfig { - // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). applicationId "com.github.florent37.example" - minSdk 19 - targetSdk 34 + minSdk 21 + targetSdk 35 versionCode flutterVersionCode.toInteger() versionName flutterVersionName + multiDexEnabled true } buildTypes { release { - // TODO: Add your own signing config for the release build. - // Signing with the debug keys for now, so `flutter run --release` works. signingConfig signingConfigs.debug - multiDexEnabled true } - debug { - multiDexEnabled true - } } } @@ -68,4 +66,6 @@ flutter { dependencies { implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" -} + implementation 'androidx.core:core-ktx:1.13.1' + implementation 'androidx.annotation:annotation:1.8.2' +} \ No newline at end of file diff --git a/example/android/app/src/main/AndroidManifest.xml b/example/android/app/src/main/AndroidManifest.xml index 8dec9fc6..b78e955e 100644 --- a/example/android/app/src/main/AndroidManifest.xml +++ b/example/android/app/src/main/AndroidManifest.xml @@ -1,6 +1,4 @@ - +