just_audio icon indicating copy to clipboard operation
just_audio copied to clipboard

bug: no audio playback possible with release build with just_audio 0.10.x (0.9.46 is fine)

Open JakobLichterfeld opened this issue 7 months ago • 3 comments

Which API doesn't behave as documented, and how does it misbehave? just_audio 0.10.x with audio_session: ^0.1.25 up to 0.2.2

When building a production release via flutter build appbundle no audio playback is possible (debug build is fine).

just_audio 0.9.46 works fine for production build

Minimal reproduction project Provide a link here using one of two options:

  1. Fork this repository and modify the example to reproduce the bug, then provide a link here.
  2. If the unmodified official example already reproduces the bug, just write "The example".

Already tried to debug and spent several days with internal Google Play App track, debugging etc.

To Reproduce (i.e. user steps, not code) Steps to reproduce the behavior:

  1. build Android App via flutter build appbundle (with or without --obfuscate --split-debug-info=...)
  2. install App via internal Google Play Store relase or bundletool build-apks --bundle=app-release.aab --output=app-release.apks and bundletool install-apks --apks=app-release.apks
  3. Try to play audio

Error messages

None

Expected behavior Audio playback should be possible not only for debug build but for production builds as well

Screenshots n.a.

Smartphone (please complete the following information):

  • Device: any Android device or emulator
  • OS: Android 15

Flutter SDK version

❯ flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.32.0, on macOS 15.5 24F74 darwin-arm64, locale de-DE)
[✓] Android toolchain - develop for Android devices (Android SDK version 36.0.0)
[✓] Xcode - develop for iOS and macOS (Xcode 16.4)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2024.3)
[✓] VS Code (version 1.100.2)
[✓] Connected device (4 available)
[✓] Network resources

• No issues found!

Additional context Add any other context about the problem here.

JakobLichterfeld avatar May 29 '25 14:05 JakobLichterfeld

Same things happen for me today. Sounds like proguard issue from the latest version! @JakobLichterfeld

Issue log:

Image

Temporary workaround:

buildTypes {
       getByName("release") {
           isDebuggable = false
           isShrinkResources = false
           isMinifyEnabled = false
           proguardFiles(
               getDefaultProguardFile("proguard-android-optimize.txt"),
               "proguard-rules.pro"
           )
           signingConfig = signingConfigs.getByName("release")
       }
   }

Happy coding :)

rrsaikat avatar May 31 '25 12:05 rrsaikat

I'm encountering the same issue: while version 0.9.46 works correctly, in the latest version, the same AudioSource fails to play after one playback.

moinkhan780 avatar Jun 07 '25 00:06 moinkhan780

Same things happen for me today. Sounds like proguard issue from the latest version! @JakobLichterfeld

Issue log:

Image

Temporary workaround:

buildTypes {
       getByName("release") {
           isDebuggable = false
           isShrinkResources = false
           isMinifyEnabled = false
           proguardFiles(
               getDefaultProguardFile("proguard-android-optimize.txt"),
               "proguard-rules.pro"
           )
           signingConfig = signingConfigs.getByName("release")
       }
   }

Happy coding :)

Thanks, this is working for android, how about web & ios ?

evchibo avatar Jun 10 '25 18:06 evchibo

No minimal reproduction project was provided. I can't see which version of AGP is being used, etc. So I'll close this.

Before anyone submits a new issue (one that follows the instructions to the letter), please check the AGP requirements in the README to ensure that you have found a new bug that hasn't already been reported.

ryanheise avatar Jun 11 '25 03:06 ryanheise

Thanks Ryan, for solving the issue with just_audio v0.10.3 by mentioning the AGP 8.6/8.7 incompatibility in the README via commit 775b9aa5.

To improve visibility for affected users, it would be helpful to also mention this change in the CHANGELOG for v0.10.x, as it impacts build compatibility.

Additionally, following SemVer more strictly would be appreciated: a compatibility-breaking dep change like this — even if only at the build level — would typically warrant at least a minor or even a major version bump instead of a patch version bump.

Minimal reproduction project

The Example project of just_audio with updated AGP and Kotlin versions.

diff --git a/just_audio/example/android/settings.gradle b/just_audio/example/android/settings.gradle
index c5ab4b5..150ff59 100644
--- a/just_audio/example/android/settings.gradle
+++ b/just_audio/example/android/settings.gradle
@@ -18,8 +18,8 @@ pluginManagement {

 plugins {
     id "dev.flutter.flutter-plugin-loader" version "1.0.0"
-    id "com.android.application" version "8.5.2" apply false
-    id "org.jetbrains.kotlin.android" version "1.8.22" apply false
+    id "com.android.application" version "8.6.1" apply false
+    id "org.jetbrains.kotlin.android" version "2.1.0" apply false
 }

 include ":app"

Workaround

As the readme now suggests, updating AGP and Kotlin versions even further resolves the issue with just_audio v0.10.3.

diff --git a/just_audio/example/android/gradle/wrapper/gradle-wrapper.properties b/just_audio/example/android/gradle/wrapper/gradle-wrapper.properties
index 3c85cfe..67f1133 100644
--- a/just_audio/example/android/gradle/wrapper/gradle-wrapper.properties
+++ b/just_audio/example/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.7-all.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-8.12.1-all.zip
diff --git a/just_audio/example/android/settings.gradle b/just_audio/example/android/settings.gradle
index c5ab4b5..78a20d7 100644
--- a/just_audio/example/android/settings.gradle
+++ b/just_audio/example/android/settings.gradle
@@ -18,8 +18,8 @@ pluginManagement {

 plugins {
     id "dev.flutter.flutter-plugin-loader" version "1.0.0"
-    id "com.android.application" version "8.5.2" apply false
-    id "org.jetbrains.kotlin.android" version "1.8.22" apply false
+    id "com.android.application" version "8.10.1" apply false
+    id "org.jetbrains.kotlin.android" version "2.1.20" apply false
 }

 include ":app"

JakobLichterfeld avatar Jun 11 '25 10:06 JakobLichterfeld

The upgrade to the minimum flutter SDK and AGP versions was part of the 0.10 release (mentioned in the CHANGELOG), and this is in fact a breaking change according to pub's interpretation of semantic versioning. The fact that there turns out to be a bug in "some" releases of AGP in the 8.x series sounds more like a semantic versioning issue with AGP itself, and I can't strictly say that all of 8.x is incompatible. It's only 8.6 and 8.7 that are buggy, while versions lower or higher than that in the same 8.x range are all compatible with just_audio's 0.10 release.

ryanheise avatar Jun 11 '25 11:06 ryanheise

Adding to that, your diff above suggests that you needed to change AGP 8.5.2 to 8.10.1, but that is not what I'm saying. 8.5.2 should work. Versions lower or higher than 8.6/8.7 should work. If you find that 8.5.2 doesn't work, that would be a new report worth investigating, but is that in fact what you're saying? If so, you will need to submit a bug report with a valid reproduction project that demonstrates this particular AGP configuration failing, whereas the official example which also uses AGP 8.5.2 works.

ryanheise avatar Jun 11 '25 11:06 ryanheise

Thanks for the clarification, Ryan.

To summarize:

  • The changelog for v0.10.0 states a minimum AGP version of 8.5.2.
  • The bug occurs with just_audio v0.10.0 – v0.10.2 when using AGP 8.6.1, as demonstrated in the minimal reproduction project. This AGP version satisfies the stated minimum and is a semver-compliant upgrade from 8.5.2.
  • The issue is resolved by upgrading to AGP 8.10.1 for example, as shown in the workaround.
  • The note about the AGP 8.6/8.7 incompatibility was added to the README just before the v0.10.3 release (see commit 775b9aa5), but this change is not mentioned in the v0.10.3 changelog and not reflected in semantic versioning.

I understand that the bug itself lies within AGP 8.6/8.7. Still, from a user’s perspective, just_audio v0.10.0, v0.10.1, v0.10.2 fails to build with an AGP version that meets the documented minimum requirement. That is a breaking change in practice — even if external — and it would be helpful to reflect this in the changelog for better visibility.

JakobLichterfeld avatar Jun 11 '25 13:06 JakobLichterfeld

The note about the AGP 8.6/8.7 incompatibility was added to the README just before the v0.10.3 release (see commit 775b9aa5), but this change is not mentioned in the v0.10.3 changelog and not reflected in semantic versioning. [...] That is a breaking change in practice

Bugs in AGP certainly do not denote breaking changes in either this plugin or in AGP. Bugs are resolved with minor version changes. The breaking change in 0.10.0 was warranted by the minimum requirements changing and the APIs changing, NOT because a particular version of AGP had a bug.

However, I understand that visibility is a legitimate request. And I would advise when an Android issue occurs, the plugin user consult all 3 of these places:

  1. This issues board
  2. The CHANGELOG
  3. The Android setup section of the README

Why not just the CHANGELOG? Because the CHANGELOG isn't necessarily updated when there isn't a direct change to the plugin. For instance, suppose that none of the AGP releases to date contained this bug. But then tomorrow, AGP released a new 8.x version containing a bug. Then person A decides to upgrade to it, encounters the bug immediately, reports a new issue here, and the culprit is discovered and I put a courtesy note in the README. Then another person B who was using just_audio 0.9.46 decides to upgrade to the new buggy AGP version and things happen to work fine. Then in a month person B decides to upgrade to just_audio 0.10.5 and finally the latent AGP bug surfaces. They consult the CHANGELOG but find nothing, because this plugin didn't change, AGP changed. Next step: they either check this issues board and find the existing issue #1468 where this was investigated and resolved, or they check the Android setup section of the README where the results of that discussion where posted as a courtesy note.

I am not strictly opposed to using the CHANGELOG for visibility, but I'm saying that you probably shouldn't rely only on the CHANGELOG because the CHANGELOG is not guaranteed to inform you when the plugin itself hasn't changed. You might get lucky and what you're looking for is mentioned in the CHANGELOG, but then again, you might not be, and you will want to check the 2 other sources as well.

ryanheise avatar Jun 11 '25 15:06 ryanheise

Thanks for the thoughtful response – I agree with most of what you’ve said.

Just to give a bit of background: I first encountered the issue on April 30th via Google Play’s internal testing track, luckily before pushing a production update. At the time, I noticed some open and resolved issues around playback (like #1118), so I assumed those were related and waited for the 0.10.2 release (As a maintainer, I do know the effort regarding unrelated issues).

After the issue persisted in my May 2nd release, I didn’t immediately have time to investigate further. Between May 27th and 29th, I reproduced the issue locally without Play Store deployment and then reported it on May 29th.

It’s worth noting that just_audio v0.9.46 worked fine with the same AGP version (8.6.1), so the upgrade from 0.9.46 to 0.10.x introduced the build issue — even though the AGP version remained unchanged. This is what made the change feel like a regression from a user’s perspective.

I now fully understand that the root cause lies within AGP itself — and I appreciate that you’re documenting this in the README directly after discovering on May 17th. My main point was that such a change in setup expectations, especially one that affects build stability for users on a SemVer-compliant upgrade path, could benefit from additional visibility, e.g. a short note in the changelog.

Not because the plugin itself changed in that specific commit, but because the user experience of upgrading just_audio under otherwise stable configurations changed. Especially when the guidance in the README is updated as a result of such findings, a reference in the changelog can go a long way in helping users stay aware of these platform-related issues (e.g. docs: mention AGP 8.6/8.7 incompatibility in README)

Thanks again for the detailed explanation and the continued maintenance of the project.

JakobLichterfeld avatar Jun 11 '25 16:06 JakobLichterfeld

This issue also affects web and ios

evchibo avatar Jun 14 '25 14:06 evchibo

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs, or use StackOverflow if you need help with just_audio.

github-actions[bot] avatar Jun 29 '25 00:06 github-actions[bot]