Android Studio 中缺少 Kotlin 暂存文件输出 [英] Kotlin scratch file output is missing in Android Studio

查看:24
本文介绍了Android Studio 中缺少 Kotlin 暂存文件输出的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 Android Studio 3.2 并尝试运行暂存文件,但找不到 println 的输出位置.

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

我的临时文件的内容:

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

但是输出窗口缺少Hello, world!"

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

我是不是找错地方了?

推荐答案

.kts 文件不需要 main 函数.您可以在顶层添加打印语句.

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

这可以解释关于 args 未使用的警告,因为 main 从未被调用.

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

脚本是具有顶级可执行代码的 Kotlin 源文件 (.kts).
使用命令行运行脚本

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

这篇关于Android Studio 中缺少 Kotlin 暂存文件输出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆