Checklist
Current bug behaviour
The Android app of my project stops building as soon as I add audioplayers as a dependency. Something is wrong with the combination of Java version, AGP version, Kotlin version (which I'm trying to upgrade).
- I'm building with Java 17:
$ java --version
openjdk 17.0.6 2023-01-17
OpenJDK Runtime Environment Temurin-17.0.6+10 (build 17.0.6+10)
OpenJDK 64-Bit Server VM Temurin-17.0.6+10 (build 17.0.6+10, mixed mode)
- My main
build.gradle has these dependencies (otherwise unchanged form the default one generated by flutter create:
dependencies {
classpath 'org.jetbrains.kotlin:kotlin-gradle-plugin:1.8.22'
classpath 'com.android.tools.build:gradle:8.0.2'
}
- The 'app' module
build.gradle is unchanged form the default except for a bump in the min SDK version. The relevant seems to be Java/Kotlin bytecode compatibility settings, which are:
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = '1.8'
}
When I execute flutter build apk, it fails with the following error:
$ flutter build apk
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':audioplayers_android:compileReleaseKotlin'.
> 'compileReleaseJavaWithJavac' task (current target is 1.8) and 'compileReleaseKotlin' task (current target is 17) jvm target compatibility should be set to the same Java version.
Consider using JVM toolchain: https://kotl.in/gradle/jvm/toolchain
When I remove audioplayers from the dependencies, the APK builds fine.
Expected behaviour
The APK builds fine with audioplayers.
Steps to reproduce
- Use the basic project provided as attachment to this report. build_failure_audioplayers.zip
- Unzip, go to the main folder, run
flutter pub get to get all the necessary files.
- Run
flutter build apk and see it fail.
- In
pubspec.yaml, remove / comment out the audioplayers dependency and run flutter build apk again - see it work.
Affected platforms
Android
AudioPlayers Version
5.1.0
Build mode
debug, profile, release
Working on PR
no way
Checklist
Current bug behaviour
The Android app of my project stops building as soon as I add
audioplayersas a dependency. Something is wrong with the combination of Java version, AGP version, Kotlin version (which I'm trying to upgrade).build.gradlehas these dependencies (otherwise unchanged form the default one generated byflutter create:dependencies { classpath 'org.jetbrains.kotlin:kotlin-gradle-plugin:1.8.22' classpath 'com.android.tools.build:gradle:8.0.2' }build.gradleis unchanged form the default except for a bump in the min SDK version. The relevant seems to be Java/Kotlin bytecode compatibility settings, which are:compileOptions { sourceCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8 } kotlinOptions { jvmTarget = '1.8' }When I execute
flutter build apk, it fails with the following error:When I remove
audioplayersfrom the dependencies, the APK builds fine.Expected behaviour
The APK builds fine with
audioplayers.Steps to reproduce
flutter pub getto get all the necessary files.flutter build apkand see it fail.pubspec.yaml, remove / comment out theaudioplayersdependency and runflutter build apkagain - see it work.Affected platforms
Android
AudioPlayers Version
5.1.0
Build mode
debug, profile, release
Working on PR
no way