【发布时间】:2018-07-06 02:55:15
【问题描述】:
我编写了一个已上传到私人服务器的库。当我将该库作为依赖项包含在我的应用程序项目中并从其中一个库类中查看源代码时,实际上并未对源代码进行反编译。它只显示类名和方法。例如:
package com.example.library.ui
public final class RoundedDrawable public constructor() : android.graphics.drawable.Drawable {
public final var backgroundColor: kotlin.Int /* compiled code */
// ... other similar fields
public open fun draw(canvas: android.graphics.Canvas): kotlin.Unit { /* compiled code */ }
// ... other similar functions
}
如您所见,它只显示/* compiled code */ cmets,而不是完整的源代码。有一个“反编译为 Java”的选项;哪个有效,但我更愿意看到 Kotlin 源代码。这可能吗?
我找到了similar question,它解释了如何显示原始 Java 代码,但对 Kotlin 没有。
【问题讨论】:
-
其实这好像是this的复制品,3个月后还没有回复:/
-
@Moira 确实如此,很好的发现。基于这个问题,看来我必须使用
task sourcesJar将源文件与 aar 文件分开上传。虽然我不确定它是如何工作的,或者我使用的服务器是否准备好处理它。我想我需要做更多的研究。
标签: android android-studio kotlin android-library