简体   繁体   中英

Kotlin scratch file output is missing in Android Studio

I'm using Android Studio 3.2 and trying to run a scratch file, but can't find where println is output.

Contents of my scratch file:

fun main(args: Array<String>) {
    println("Hello, world!")
}

But the output window is missing "Hello, world!"

在此输入图像描述

Am I looking in the wrong place?

A .kts file doesn't require a main function. You can add the print statement at the top level.

This would explain the warning about args being unused, since main is never invoked.

A script is a Kotlin source file (.kts) with top level executable code.
Using the command line to run scripts

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM