【错误记录】Android Studio 编译时 Kotlin 代码编译报错 ( Not enough information to infer type variable T )
生活随笔
收集整理的这篇文章主要介绍了
【错误记录】Android Studio 编译时 Kotlin 代码编译报错 ( Not enough information to infer type variable T )
小编觉得挺不错的,现在分享给大家,帮大家做个参考.
文章目录
- 一、报错信息
- 二、解决方案
一、报错信息
在 Kotlin 代码中调用
findViewById(R.id.button)代码 , 编译时报如下错误信息 :
Not enough information to infer type variable T上午还能编译 , 下午更新了下支持库到 28.0.028.0.028.0.0 就出现上述错误 ;
按照当前的 Kotlin 规范 , 重新修改 Kotlin 的相关代码 ;
二、解决方案
将组件查找代码修改为如下形式 , 添加泛型 ;
findViewById<View>(R.id.button)总结
以上是生活随笔为你收集整理的【错误记录】Android Studio 编译时 Kotlin 代码编译报错 ( Not enough information to infer type variable T )的全部内容,希望文章能够帮你解决所遇到的问题。
- 上一篇: 【错误记录】Android Studio
- 下一篇: 【错误记录】Android Studio