Flutter编译安卓应用时遇到的compileDebugJavaWithJavac和compileDebugKotlin版本不匹配的问题
记一次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