简体   繁体   中英

is it safe to migrate whole android project in kotlin at once?

We have one mobile project fully developed in native android using android sdk. we want to migrate the code base to kotlin completely. So wanted to know what are main things to keep in mind while migrating to Kotlin.

I don't recommend to switch full code automatically to Kotlin. The tool for converting to Kotlin is great but you have to review all code generated by the tool. Sometimes code generated are not really readable.

Java and Kotlin can be use together. You can convert files one by one. You have time to check and clean the converted code.

Before you convert your project from Java to Kotlin keep things in your mind.

  1. Converting from Java to Kotlin will may cause your git track. Refer to avoid this problem
  2. Android studio provide easy way to convert Java code into Kotlin in a automate way [Press Ctrl+Alt+Shift+K]. But it may arise some conflicts like " Some code in the rest of your project may require corrections after performing this conversion. Do you want to find such code and correct it too? ". For example in your java file contains static variables. Because kotlin didn't support static. In this case you have to manually correct it. It took some time.
  3. While developing you may maintain many branches. If you converted one file from Java to Kotlin will affect other branch.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM