Closed livelitoday closed 1 year ago
有解决么?
has a same issure
将Booster version 4.14.0改为成功了
@johnsonlee
我最近用一个新项目集成booster也遇到了这个问题。
分析了下,发现应该是因为booster前段时间升级gradle之后,embeddedKotlinVersion从原来的1.3.61(gradle 6.2)升级到了1.5.31(gradle 7.4).然后在源码中大量使用了被@SinceKotlin("xxx") (其中xxx大于1.4)注释的api方法.
比如这个issue提到的Iterable.maxOrNull
方法:
@SinceKotlin("1.4")
public fun <T : Comparable<T>> Iterable<T>.maxOrNull(): T? {
val iterator = iterator()
if (!iterator.hasNext()) return null
var max = iterator.next()
while (iterator.hasNext()) {
val e = iterator.next()
if (max < e) max = e
}
return max
}
gradle embeddedKotlinVersion参见: https://docs.gradle.org/current/userguide/compatibility.html#kotlin
这样会导致仍在使用小于等于6.7的gradle版本(对应embeddedKotlinVersion为1.3.72)的人,在编译时使用的仍是低版本的kotlin,从而找不到在源码中使用的高版本的kotlin api.
不知道直接把build.gradle中这里的kotlin version:
https://github.com/didi/booster/blob/cd35577df987e2151bdf423d2473622e0f007552/build.gradle#L4
直接替换为:
ext.kotlin_version = "1.5.31"
能不能解决这个问题,同时也不影响兼容性?
Please provide the following informations.
System version Win10
Java version 1.8
Gradle version 5.6.4
Android Gradle plugin version 3.6.3
Booster version 4.15.0
Stack traces Execution failed for task ':app:transformClassesWithBoosterForXXXDebug'.
kotlin.collections.CollectionsKt.maxOrNull(Ljava/lang/Iterable;)Ljava/lang/Comparable;
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.