今天想嘗試一下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'