文章目录
- 一、报错信息
- 二、解决方案
一、报错信息
Kotlin 1.5.0 1.5.0 1.5.0 后语法与之前不同 , Float 类型不能直接转为 Byte 类型 , 需要先转为 Int , 然后转为 Byte 类型 ;
e: D:\002_Project\MyApplication\app\src\main\java\kim\hsl\plyer\Player.kt: (958, 50): Using 'toByte(): Byte' is an error. Unclear conversion. To achieve the same result convert to Int explicitly and then to Byte.
二、解决方案
将
1.0F.toByte()
修改为
1.0F.toInt().toByte()
这次更新 Kotlin 版本 , 修改较大 ;