问题描述
谁能帮助我将 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 for
Java Bytecode Decompiler` >> check the plugin & press OK.
这篇关于将 Kotlin 转换为 Java的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!