且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

构建失败,并在Kotlin中出现异常错误

更新时间:2022-11-07 19:43:51

这是告诉您,您创建了一个Android项目,但是Android应用程序使用Android生命周期运行,而不是main生命周期.

This is telling you that you created an Android project but that Android applications use the Android lifecycle to run, not main.

如果您要执行普通的kotlin代码,一种选择是使用File->向项目添加kotlin库.新模块-> Kotlin并在其中添加主要方法

If you want to execute plain kotlin code one option is to add a kotlin library to the project using File -> New Module -> Kotlin and add the main method there