Quickly Run Kotlin Code in Android Studio and IntelliJ

preview_player
Показать описание
#ToolsandTipsTuesday #AndroidDev #Kotlin

In this video, you'll see how to quickly run Kotlin code in Android Studio and IntelliJ without having to run your program or writes tests. This can be really useful when you want to quickly validate some Kotlin code without the full setup required for testing.

0:33 Android Studio
2:17 IntelliJ
--------

🙂 Follow Me Online
--------

💡More Kotlin Resources:

--------

🎒Check out books & gear that have helped me out
Рекомендации по теме
Комментарии
Автор

Did you know you could run your Kotlin code by simply supplying a top-level main function... even in Android Studio?

goobar
Автор

Just learning Kotlin and I had trouble with just the code trying to run through my virtual device and this simple tip helped me run just my function so I can see my output. Thank you!

StudyAndChillSounds
Автор

Thank you so muck. I was just looking for that topic on my pc for quite some days. Love from India.

nagaland
Автор

Great tip!
The only disappointing thing this, for Android Studio it might be slow, because it rebuilds the whole project :)

rahuldeshpande
Автор

Great! This what I was looking for, except for a question: can I run that simple main program on the Android device? Through adb I guess? Or is it already running on a connected device without anything else special to do?

giuliocasa
Автор

Cool tip! By the way, there is a live template to generate a main function for you

you can just type "main" + enter
or "main0" + enter if you want the args parameter (args is not required on kotlin >= 1.3)

JeffreyStarke
Автор

I have issues that gradle build fails. Could you please take a look?
5:20:06 PM: Executing task 'KotlinBasics2Kt.main()'...

Executing tasks: [KotlinBasics2Kt.main()] in project


FAILURE: Build failed with an exception.

* Where:
Initialization script line: 27

* What went wrong:
A problem occurred configuring project ':app'.
> Could not create task
> SourceSet with name 'main' not found.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.


BUILD FAILED in 386ms
5:20:07 PM: Task execution finished 'KotlinBasics2Kt.main()'.

liyang
Автор

Great tip!
it's save my time a lot Thank you for this :)

satishvanjara
Автор

i have the latest android studio but its not working. no play button appears

jemanue
Автор

it works also java but public static void main(String[] args){//todo something without emulator thx to god} by then thank you goobar

burakusluer
Автор

I tried following Kotlin tutorials in IntelliJ but it has no colors.xml or recycler view.
How do I create an Android App using Kotlin on IntelliJ? I just downloaded IntelliJ and deleted Android Studio but 100% of all Ecommerce app in Kotlin are in Android Studio? Thanks
100% beginner programmer

inang