为什么我只看到官方android类的反编译源代码?

时间:2019-11-19 01:08:25

标签: android-studio androidx

请注意,我之前已经通过AS 3.5.2 SDK管理器安装了 Android SDK文档

在编辑Java源代码时,请考虑以下不一致的行为...

import android.app.Fragment;    // Deprecated! 

如果将鼠标悬停在 Fragment 上,则会获得格式精美的JavaDoc广泛帮助。此外,在“文档”窗口的底部,有一个选项 Fragment 的外部文档,该文档链接到本地​​文件:

file:///home/daz/Android/Sdk/docs/reference/android/app/Fragment.html

现在,移动到androidX ...

import androidx.fragment.app.Fragment;
import androidx.constraintlayout.motion.widget.MotionLayout;

如果我将鼠标悬停在 Fragment 上,我会得到一个简短的帮助,该帮助将我带到“框架”文档。 (不太优雅但可以接受)

但是,如果我将鼠标悬停在 MotionLayout 上,除了对

的引用之外,我一无所获
Gradle: androidx.constraintlayout:constraintlayout:2.0.0-beta3@aar

如果我去声明,则会得到反编译的源代码,每当我尝试编码方法时,都必须在互联网上搜索参数。查看反编译源时,所有尝试选择下载的尝试均以失败告终。

我认为这是不可接受的-存在良好的文档,我想轻松地获得它!

https://developer.android.com/reference/androidx/constraintlayout/motion/widget/MotionLayout

我很欣赏 MotionLayout 是一个相对较新的公告(2018),但这不是一个孤立的案例。

为什么会这样?

1 个答案:

答案 0 :(得分:0)

确定源.jar是否与 .aar 一起提供:

示例: androidx.fragment.app.Fragment
假设外部库:等级:androidx.fragment:fragment:1.1.0@aar

EITHER右键单击外部库(从 Project 视图)->库属性...
或导航到:

.../.gradle/caches/modules-2/files-2.1/androidx.fragment/fragment/1.1.0

展开子文件夹并确认类似

b9ebb04df2cb0cad4419af3c658690bc82aa5706/fragment-1.1.0-sources.jar

示例: androidx.constraintlayout.widget.ConstraintLayout
假设外部库:等级:androidx.constraintlayout:constraintlayout:2.0.0-beta3@aar

使用上述方法,您将快速确定不存在 sources.jar 。 (您只会看到 .aar .pom

确定为什么不超出此问题的范围。

直到有人提供了更令人满意的答案之前,您都可以尝试使用此grubby hack

更新2019年11月21日
如果您的问题与ConstraintLayout或MotionLayout有关,请给这个已知的issue加上星号。