【发布时间】:2019-01-27 20:27:35
【问题描述】:
我最近安装了 Android Studio 3.3,并且我同时安装了 Android SDK Platform 28 和 Sources for Android 28(均在 Android 9.0 下)。但 Android Studio 实际上并没有检测到任何 Android 库类的源代码,因此我无法查看它们的 javadocs 或阅读它们的源代码。
具体来说,我的应用build.gradle 大致是这样的:
android {
compileSdkVersion 28
defaultConfig {
minSdkVersion 17
targetSdkVersion 28
}
// other stuff...
}
dependencies {
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:design:28.0.0'
implementation 'com.android.support:recyclerview-v7:28.0.0'
implementation 'com.android.support:support-v4:28.0.0'
implementation 'android.arch.lifecycle:extensions:1.1.1'
implementation 'org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.3.11'
implementation 'com.github.bumptech.glide:glide:4.8.0'
implementation 'com.google.android:flexbox:1.1.0'
implementation 'com.squareup.okhttp3:okhttp:3.11.0'
implementation 'joda-time:joda-time:2.10'
implementation 'org.greenrobot:eventbus:3.1.1'
implementation 'org.jsoup:jsoup:1.11.3'
}
底部的库,如 Kotlin 标准库、Glide、OkHttp、FlexBox 等,都带有它们的源代码,所以我在那里没有问题。但是顶部的库没有附加任何资源。所以android.app、android.support.v4.app和其他Android包中的类当我点击它们时没有javadocs,当我尝试查看源代码时,AS反而反编译了类文件。
Decompiled .class file, bytecode version: 51.0 (Java 7)
选择Download Sources 没有任何效果,我不想手动选择源,因为在升级 IDE 之前我从来不需要这样做。该应用程序仍然可以毫无问题地构建,只是那些缺少的资源才是问题所在。有没有办法让 Android Studio 自动检测来源并解决这个问题?
【问题讨论】:
标签: android android-studio android-gradle-plugin