What is the purpose of using .kts files in Kotlin? Are these files included in the app bundle when releasing the app?
Asked
Active
Viewed 1.6k times
42
-
You can check this in your apk – twlkyao May 16 '20 at 07:48
2 Answers
59
.kt
— normal source files, .kts
— script files
You don't need the main
function in a .kts
file, It will be executed line by line just like a bash/python script.
The .kts
files don't need separate compilation. You run them using the following command:
kotlinc -script <filename>.kts

hippietrail
- 15,848
- 18
- 99
- 158

Govinda Sakhare
- 5,009
- 6
- 33
- 74
11
.Kt and .Kts
- They are all kotlin files that contain kotlin source code.
- .kt file are assumed to be compiled by the kotlin compiler.
- .Kts files are assumed to be executed by kotlin scriting support.
As Explained in kolinConf18

Paulodhiambo
- 111
- 1
- 6