At Google I/O 2017, it was announced that Kotlin will become the official language for Android development. While this news is great, it poses concerns for developers who will eventually need to update their existing Java code to the new language. Luckily, Android Studio includes a tool to make the transition more seamless by actually converting a selected Java file to Kotlin. Here’s how to use it!
- First, update everything in Android Studio. Pretty self-explanatory there.
- Open up a Java code file. In the top menubar, click “Code” then “Convert Java File to Kotlin File.” Please note the message about your code potentially being incorrect then click “OK.”
- If you get a message saying “Kotlin not configured,” simply click “Configure>Android with Gradle,” then click “OK.”
- Resync your Gradle
- and you’re done!
For more programming and general tech guides, subscribe to us on YouTube!