Flutter: Execution failed for task ':audio_session:compileDebugJavaWithJavac'

389 Views Asked by At

I'm encountering a compilation error in my Flutter project after adding the audio_service and just_audio packages. The error message I'm receiving is as follows:

Launching lib\main.dart on Android SDK built for x86 64 in debug mode...
main.dart:1
warning: [options] source value 8 is obsolete and will be removed in a future release
warning: [options] target value 8 is obsolete and will be removed in a future release
warning: [options] To suppress warnings about obsolete options, use -Xlint:-options.
error: warnings found and -Werror specified

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':audio_session:compileDebugJavaWithJavac'.
> Compilation failed; see the compiler error output for details.

* Try:
> Run with --info option to get more log output.
> Run with --scan to get full insights.

BUILD FAILED in 14s
Exception: Gradle task assembleDebug failed with exit code 1
Exited (sigterm)
1

There are 1 best solutions below

0
Bimantaratirta On

If you're compiling the Flutter Project using android sdk 34, audio_session will throw error, you can check this github issue. Solution is just change the compileSdkVersion at /android/app/build.gradle.

android {
   compileSdkVersion 33
   ...
}