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

查看:222
本文介绍了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!")
}

但是输出窗口中缺少你好,世界!"

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.

这将解释有关由于未调用main而未使用args的警告.

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天全站免登陆