Android编译报错
zhanghsgithub opened this issue · comments
zhanghsgithub commented
我的build.gradle 里面的配置是
buildscript {
ext.kotlin_version = '1.5.21'
}
在编译android的时候报错
下面是报错信息,
e: /Users/***/.pub-cache/hosted/pub.flutter-io.cn/flutter_unionad-1.3.8/android/src/main/kotlin/com/gstory/flutter_unionad/FlutterUnionadPlugin.kt: (118, 26): The feature "trailing commas" is only available since language version 1.4
e: /Users/***/.pub-cache/hosted/pub.flutter-io.cn/flutter_unionad-1.3.8/android/src/main/kotlin/com/gstory/flutter_unionad/TTAdManagerHolder.kt: (77, 28): The feature "trailing commas" is only available since language version 1.4
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':flutter_unionad: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
gstory commented
1、 ext.kotlin_version = '1.6.10' 尝试使用这个
2、查看本地是否还有引用低版本kt
3、AS设置中找到plugins中kt插件的版本是否最新
zhanghsgithub commented
1、 ext.kotlin_version = '1.6.10' 尝试使用这个 2、查看本地是否还有引用低版本kt 3、AS设置中找到plugins中kt插件的版本是否最新
我看你提供的这个插件里面的配置是1.3.72 和这个有关系吗?
group 'com.gstory.flutter_unionad'
version '1.0-SNAPSHOT'
buildscript {
ext.kotlin_version = '1.3.72'
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.0.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
gstory commented
可能是的,example中使用的1.6.10,所以运行没有出问题,后续版本修复这个问题,1.4以下版本方法参数以“,”结尾会有这个问题
gstory commented
@zhanghsgithub 更新1.3.9再试试
zhanghsgithub commented
这个插件不报错了,其它的插件报错了 -_-!
错误: 程序包org.jetbrains.annotations不存在
import org.jetbrains.annotations.NotNull;
gstory commented
缺啥导入啥
zhanghsgithub commented
ok
flutter 升级到了3.0了,没有问题了。