Android Kotlin: RuntimeException: Unable to instantiate activity ComponentInfo{...}

今天想嘗試一下kotlin寫個Android Demo, 結果運行總是直接crash,報以下錯:

java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.***.demo/com.***.demo.android.**Activity}: java.lang.ClassNotFoundException: Didn't find class "***" on path: DexPathLis

 

查閱資料後發現是配置問題:

需要在build.gradle中加上一句:

apply plugin: 'kotlin-android'

 

 

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章