gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-12-05 07:17:04 26 4
gpt4 key购买 nike

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

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

import android.app.Fragment;    // Deprecated! 

如果我将鼠标悬停在 Fragment 上,我会得到广泛的、格式精美的 JavaDoc 帮助。此外,在文档窗口的底部有一个选项 External documentation for 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

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

我认为这是 Not Acceptable - 有很好的文档,我想轻松获得它!

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

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

为什么会这样?为什么 Android Studio 找不到官方 Android 源代码?

最佳答案

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

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

EITHER 右键单击​​外部库(从 Project View )--> Library Properties ...
或导航至:

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

展开子文件夹并确认类似

b9ebb04df2cb0cad4419af3c658690bc82aa5706/fragment-1.1.0-sources.jar

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

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

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

在有人提供更满意的答案之前,您可能想试试这个grubby hack .

2019 年 11 月 21 日更新:
如果您的问题与 ConstraintLayout 或 MotionLayout 有关,请为这个已知的 issue 加注星标.

关于android-studio - 为什么我只看到官方 android 类的反编译源代码?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58925243/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com