如何制作Android Studio 下载依赖源和javadoc? [英] How to make Android Studio download dependencies sources and javadoc?

查看:29
本文介绍了如何制作Android Studio 下载依赖源和javadoc?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经检查过这篇文章:如何在IDEA中下载Gradle项目的依赖源?

I have already checked this post: How to download dependency sources for Gradle project in IDEA?

但它对我不起作用.也许是因为他们指的是 IntelliJ Idea,而我在使用 Android Studio 时遇到了问题.

But it didn't work for me. Maybe it is because they are referring to IntelliJ Idea, and I am having the issue with Android Studio.

我已经尝试添加

apply plugin: 'idea'
idea {
    module {
        downloadJavadoc = true
        downloadSources = true
    }
}

到 root 的 build.gradle 文件(我在多项目设置中)或应用程序的 build.gradle 文件.

Both to root's build.gradle file (I am in a multiproject setup) or to the application's build.gradle file.

我的应用程序的 gradle 文件:

My application's gradle file:

buildscript {
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:0.4.2'
    }
}

repositories {
    mavenCentral()
}
dependencies {
    compile files('libs/android-support-v4.jar')
    compile 'com.nostra13.universalimageloader:universal-image-loader:1.8.4'
}
android {
    compileSdkVersion 17
    buildToolsVersion "17.0.0"

    defaultConfig {
        minSdkVersion 7
        targetSdkVersion 16
    }
}

然后,在 Android Studio 中,当我单击通用图像加载器库中的任何方法时,我会看到一个屏幕,提示没有附加源.如果我单击附加源,它会显示:

Then, in Android Studio when I click on any method from the universalimageloader library, I get to a screen saying that there are no sources attached. If I click attach sources it shows:

如您所见,只有 lib 的 jar 被下载到 gradle 缓存.没有下载 *-sources.jar 或 *-javadoc.jar.我已经清理了项目,删除了 .gradle 文件夹以强制它从 maven 再次下载.没有运气.

As you can see, only the lib's jar was downloaded to gradle cache. No *-sources.jar or *-javadoc.jar were downloaded. I have cleaned project, removed .gradle folder to force it to download again from maven. No luck.

我仔细检查了加载的通用图像在 maven 中有可用的源和 javadoc,所以这不是问题.

I double checked that universal image loaded has sources and javadoc available in maven, so that is not the problem.

谢谢!

推荐答案

目前 Android Studio 导入带有源的库.至于java docs按F1.

Currently Android Studio imports libraries with sources. As for java docs press F1.

旧答案:

当我们谈论早期预览时,最简单的修复获胜.

As we are talking about early preview, simplest fix wins.

现在只是在项目结构"对话框中手动将它们添加到项目中.情况更糟,因为现在 Android Studio 将从所有与原生 Android Gradle 配置和任务无关的依赖项中剥离模块文件 (iml),例如模块具有 robolectric 依赖项和额外的任务,并且在 build.gradle 中添加了配置 localTest.打开 Android Studio 后,它会删除依赖项,您需要再次添加它.

For now is just manually add them to the project in Project Structure dialog. Things are even worse as now Android Studio will strip module files (iml) from all dependencies which are not related to native Android Gradle configurations and tasks e.g. module has robolectric dependency and extra task and config localTest is added in build.gradle. After you open Android Studio it will remove dependency, you need to add it again.

暂时我将 iml 文件和 .idea 文件夹保存在我的 git 中.启动后

For time being I am keeping iml files and .idea folder in my git. After launch

git checkout myproject/myproject.iml

这篇关于如何制作Android Studio 下载依赖源和javadoc?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆