【错误记录】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