記一次flutter應用,編譯安卓時,報的一個compileDebugJavaWithJavac和compileDebugKotlin版本本匹配的問題。
最終定位的原因是項目一來了audioplayers組件。 audioplayers組件有依賴了audioplayers_android, 它使用1.8編譯的。 版本過低。后來更新了 audioplayers: ^6.5.0 (默認以來的audioplayers_android為5.2.1版本), 再次build就通過了。
Task :audioplayers_android:compileDebugKotlin FAILED
FAILURE: Build failed with an exception.
- What went wrong:
Execution failed for task ‘:audioplayers_android:compileDebugKotlin’.
‘compileDebugJavaWithJavac’ task (current target is 1.8) and ‘compileDebugKotlin’ 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