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

查看:3602
本文介绍了将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?

推荐答案

当前仅对位于 Kotlin 类(.class,而不是.kt扩展名)启用Tools >> Kotlin>> Decompile Kotlin to Java > 构建成功后.

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 解决方法的注释:

如果已禁用(或未显示)Tools >> Kotlin >> Show Kotlin Bytecode >> Decompile button,则应安装Java Bytecode Decompiler插件:Preferences >> Plugins >> search for 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天全站免登陆