| Start |
|---|
| Gradle configuration
It's a good idea to externalize this version in Then you need to apply this plugin to your project. The way you do this differs when targeting different platforms: Targeting JVMTargeting AndroidTargeting JSThese are the default paths:
You may need to configure Finally, you'll need to add Kotlin standard library dependency to your project: If you want to use Kotlin Reflection you'll also need to add |
| Using Android Studio Android Studio can configure Kotlin automatically in an Android project. Install the pluginTo install the Kotlin plugin, go to File > Settings > Editor > Plugins > Install JetBrains Plugin... > Kotlin > Install, then restart Android Studio when prompted. Configure a projectCreate an Android Studio project as normal, then press Ctrl + Shift + A. In the search box, type "Configure Kotlin in Project" and press Enter. Android Studio will alter your Gradle files to add all the necessary dependencies. Converting JavaTo convert your Java files to Kotlin files, press Ctrl + Shift + A and find "Convert Java File to Kotlin File". This will change the current file's extension to |
| Migrating from Gradle using Groovy script to Kotlin script Steps:
update the content of the now open Intellij and open your project, in the explorer window, it should be recognized as a Gradle project, if not, expand it first. after opening, let Intellij works, open open the Gradle window and refresh it If you are on Windows, you may encounter this bug (opens new window), download the full Gradle 3.3 distribution and use that instead the one provided. Related (opens new window). OSX and Ubuntu work out of the box. Small bonus, if you want to avoid all the hassle of publicing on Maven and similar, use Jitpack (opens new window), the lines to add are almost identical compared to Groovy. You can take inspiration from this project (opens new window) of mine. |
Read Article
https://develop.horje.com/learn/1434/reference