From 04cfd8f3b3fb91cb266e681caec63137910ff694 Mon Sep 17 00:00:00 2001 From: Moritz Messner <48797914+MoritzMessner@users.noreply.github.com> Date: Wed, 11 Jun 2025 20:20:13 +0200 Subject: [PATCH 1/6] typo: change _receieveChannel to _receiveChannel --- lib/src/assets_audio_player.dart | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/src/assets_audio_player.dart b/lib/src/assets_audio_player.dart index 6dc57b70..be4c5ce6 100644 --- a/lib/src/assets_audio_player.dart +++ b/lib/src/assets_audio_player.dart @@ -185,7 +185,7 @@ class AssetsAudioPlayer { /// The channel between the native and Dart final MethodChannel _sendChannel = const MethodChannel('assets_audio_player'); - late MethodChannel _recieveChannel; + late MethodChannel _receiveChannel; /// Stores opened asset audio path to use it on the `_current` BehaviorSubject (in `PlayingAudio`) Audio? _lastOpenedAssetsAudio; @@ -546,8 +546,8 @@ class AssetsAudioPlayer { _playerEditor = PlayerEditor._(this); - _recieveChannel = MethodChannel('assets_audio_player/$id'); - _recieveChannel.setMethodCallHandler((MethodCall call) async { + _receiveChannel = MethodChannel('assets_audio_player/$id'); + _receiveChannel.setMethodCallHandler((MethodCall call) async { // print('received call ${call.method} with arguments ${call.arguments}'); switch (call.method) { case 'log': From 9683328f6c1bf33563724e9927adc33fe30132e8 Mon Sep 17 00:00:00 2001 From: Moritz Messner <48797914+MoritzMessner@users.noreply.github.com> Date: Wed, 11 Jun 2025 20:22:06 +0200 Subject: [PATCH 2/6] typo: change overriden to overridden --- lib/src/assets_audio_player.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/src/assets_audio_player.dart b/lib/src/assets_audio_player.dart index be4c5ce6..3526c06d 100644 --- a/lib/src/assets_audio_player.dart +++ b/lib/src/assets_audio_player.dart @@ -538,7 +538,7 @@ class AssetsAudioPlayer { } void _init() { - // default action, can be overriden using player.onErrorDo = (error, player) { ACTION }; + // default action, can be overridden using player.onErrorDo = (error, player) { ACTION }; onErrorDo = (errorHandler) { print(errorHandler.error.message); errorHandler.player.stop(); From f6556ca89c09e67ff61bfdae60a1e641a87d6190 Mon Sep 17 00:00:00 2001 From: Moritz Messner <48797914+MoritzMessner@users.noreply.github.com> Date: Wed, 11 Jun 2025 20:23:51 +0200 Subject: [PATCH 3/6] typo: change was'nt to wasn't --- lib/src/assets_audio_player.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/src/assets_audio_player.dart b/lib/src/assets_audio_player.dart index 3526c06d..9b00110a 100644 --- a/lib/src/assets_audio_player.dart +++ b/lib/src/assets_audio_player.dart @@ -473,7 +473,7 @@ class AssetsAudioPlayer { /// toggle the looping state /// if it was looping -> stops this - /// if it was'nt looping -> now it is + /// if it wasn't looping -> now it is Future toggleLoop() async { if (_playlist != null) { final currentMode = loopMode.value; From 39133adac7ece6be0db033dee2cca221d60338e6 Mon Sep 17 00:00:00 2001 From: Moritz Messner <48797914+MoritzMessner@users.noreply.github.com> Date: Wed, 11 Jun 2025 20:26:49 +0200 Subject: [PATCH 4/6] typo: change stram to stream --- lib/src/assets_audio_player.dart | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/src/assets_audio_player.dart b/lib/src/assets_audio_player.dart index 9b00110a..dd74f879 100644 --- a/lib/src/assets_audio_player.dart +++ b/lib/src/assets_audio_player.dart @@ -343,14 +343,14 @@ class AssetsAudioPlayer { ValueStream get playlistFinished => _playlistFinished.stream; /// Called when the current playlist song has finished (mutable) - /// Using a playlist, the `finished` stram will be called only if the complete playlist finished + /// Using a playlist, the `finished` stream will be called only if the complete playlist finished /// _assetsAudioPlayer.playlistAudioFinished.listen((audio){ /// the $audio has finished to play, moving to next audio /// }) final PublishSubject _playlistAudioFinished = PublishSubject(); /// Called when the current playlist song has finished - /// Using a playlist, the `finished` stram will be called only if the complete playlist finished + /// Using a playlist, the `finished` stream will be called only if the complete playlist finished Stream get playlistAudioFinished => _playlistAudioFinished.stream; /// Then current playing song position (in seconds) (mutable) From 5061cd55ce81b1118c7f980a996f181c4dcd1f37 Mon Sep 17 00:00:00 2001 From: Moritz Messner <48797914+MoritzMessner@users.noreply.github.com> Date: Wed, 11 Jun 2025 20:27:58 +0200 Subject: [PATCH 5/6] typo: change was'nt to wasn't --- lib/src/assets_audio_player.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/src/assets_audio_player.dart b/lib/src/assets_audio_player.dart index dd74f879..aed176f4 100644 --- a/lib/src/assets_audio_player.dart +++ b/lib/src/assets_audio_player.dart @@ -497,7 +497,7 @@ class AssetsAudioPlayer { /// toggle the shuffling state /// if it was shuffling -> stops this - /// if it was'nt shuffling -> now it is + /// if it wasn't shuffling -> now it is void toggleShuffle() { shuffle = !shuffle; _updatePlaylistIndexes(); From d4fc82f998c6fc543ad6a2afc61f862789b05f54 Mon Sep 17 00:00:00 2001 From: Moritz Messner <48797914+MoritzMessner@users.noreply.github.com> Date: Mon, 11 Aug 2025 18:41:14 +0200 Subject: [PATCH 6/6] Update to Android API 35 (Android 15) for Google Play compliance - Updated compileSdk and targetSdk to 35 - Upgraded Android Gradle Plugin to 8.7.3 - Updated Kotlin to 1.9.25 with proper null safety - Updated Gradle wrapper to 8.11.1 - Updated JVM target to 17 for compatibility - Updated AndroidX dependencies and media libraries - Fixed Kotlin null safety issue in HeadsetManager - Modernized Android build configuration - Removed incompatible example dependencies - Successfully tested on Android emulator Fixes Google Play Store requirement for API level 35 targeting. --- android/build.gradle | 18 ++++---- .../gradle/wrapper/gradle-wrapper.properties | 2 +- .../stopwhencall/HeadsetManager.kt | 2 +- example/android/app/build.gradle | 42 +++++++++---------- .../android/app/src/main/AndroidManifest.xml | 4 +- .../florent37/example/MainActivity.java | 6 +++ .../github/florent37/example/MainActivity.kt | 6 --- example/android/build.gradle | 4 +- .../gradle/wrapper/gradle-wrapper.properties | 2 +- example/android/settings.gradle | 32 +++++++++----- example/ios/Flutter/AppFrameworkInfo.plist | 2 +- example/ios/Podfile | 2 +- example/ios/Runner.xcodeproj/project.pbxproj | 34 +++++++++------ .../xcshareddata/xcschemes/Runner.xcscheme | 3 +- example/ios/Runner/AppDelegate.swift | 2 +- example/ios/Runner/Info.plist | 2 + example/pubspec.yaml | 16 +++---- 17 files changed, 100 insertions(+), 79 deletions(-) create mode 100644 example/android/app/src/main/java/com/github/florent37/example/MainActivity.java delete mode 100644 example/android/app/src/main/kotlin/com/github/florent37/example/MainActivity.kt 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 @@ - +