How to Use Kotlin in an Existing Android App?

前端 未结 9 1029
清酒与你
清酒与你 2021-01-05 03:18

I have an Android App developed using Java. I now want to start using Kotlin for the same app. Is it possible to use Kotlin and Java side-by-side in an existing app?

9条回答
  •  Happy的楠姐
    2021-01-05 04:03

    It is possible to use Java and Kotlin side by side. If it is a small project I would recommend you converting your existing java files into Kotlin, this can be easily done using the ctrl+alt+shift_k shortcut. if the project is pretty large you can keep your java classes while creating new activities in Kotlin. I have an app that many of my model classes are written in java yet the activity and the UI itself is written in Kotlin. Since Kotlin is based on Java there is no problem having both languages in the same project as long as your java files are created in different classes than your Kotlin classes

提交回复
热议问题