Flutter使用fluwx后,打包android 编译报以下错误。
Running Gradle task 'assembleRelease'...
e: /Users/ado/my/dev_tools/flutter/.pub-cache/hosted/pub.flutter-io.cn/fluwx_no_pay-2.5.2/android/src/main/kotlin/com/jarvan/fluwx/handlers/FluwxRequestHandler.kt: (54, 52): Expecting an argument
FAILURE: Build failed with an exception.
* What went wrong:
* Execution failed for task ':fluwx_no_pay:compileReleaseKotlin'.
> Compilation error. See log for more details
> * Try:
> Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
查看官方Github issues,发现是kotlin版本问题。
解决办法
打开android/build.gradle文件
将 ext.kotlin_version的值改为1.4.20,重新编译即可。
buildscript {
// ext.kotlin_version = '1.3.50'
ext.kotlin_version = '1.4.20'
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.5.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}