Is It Safe to Convert Java Code to Kotlin Code | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Is It Safe to Convert Java Code to Kotlin Code

Is it a good idea to convert an android studio project from Java to Kotlin? By just converting the code inside java activity classes to Kotlin? Or will there be any behind the scene java code that could cause problems now or late? ?? Or is it better to create a whole new project from scratch for Kotlin?

4th Sep 2019, 12:56 PM
Waqas Shah
Waqas Shah - avatar
3 Answers
+ 7
I converted a few thousand lines and spent an hour fixing compile errors (using Intellij.) Mostly due to the differences in classes between the two languages. Once fixed, it ran perfectly. However, it would have taken me much longer recoding in Kotlin myself.
8th Sep 2019, 12:07 AM
John Wells
John Wells - avatar
+ 3
If you know kotlin then use kotlin rather than using java but you still have to use some java class in kotlin.
5th Sep 2019, 5:25 PM
Smit Kalkani
Smit Kalkani - avatar
+ 2
It depends I mean you still have to fix some code. By your own but yes it is worth but it all depends
5th Sep 2019, 5:25 PM
Smit Kalkani
Smit Kalkani - avatar