将 Kotlin 转换为 Java [英] Converting Kotlin to Java

查看:73
本文介绍了将 Kotlin 转换为 Java的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

谁能帮助我将 Android Studio 中的 Kotlin 代码转换为 Java?

Can anyone help me about converting Kotlin code in Android Studio to Java?

我经历了以下过程:

工具 >> Kotlin>> 将 Kotlin 反编译为 Java

但是Kotlin to Java"选项被禁用.我该怎么办?

But the "Kotlin to Java" option is disabled. What should I do?

推荐答案

目前 Tools >>科特林>>Decompile Kotlin to Java 仅对位于 的编译的 Kotlin 类(.class,而不是 .kt 扩展名)启用app/build/tmp/kotlin-classes/ 构建成功后.

Currently Tools >> Kotlin>> Decompile Kotlin to Java is enabled only for compiled Kotlin classes (.class, not .kt extension) located at app/build/tmp/kotlin-classes/ after a successful build.

@Uriel Frankel 的解决方法的说明:

A note to the @Uriel Frankel's workaround:

如果<代码>工具>>科特林 >>显示 Kotlin 字节码 >>反编译按钮被禁用(或未显示)应该安装Java Bytecode Decompiler插件:Preferences >>插件 >>搜索Java Bytecode Decompiler`>>检查插件&按确定.

If Tools >> Kotlin >> Show Kotlin Bytecode >> Decompile button is disabled (or not shown) the Java Bytecode Decompiler plugin should be installed: Preferences >> Plugins >> search forJava Bytecode Decompiler` >> check the plugin & press OK.

这篇关于将 Kotlin 转换为 Java的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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