Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
700 views
in Technique[技术] by (71.8m points)

maven - How to make Android Studio download dependencies sources and javadoc?

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

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.

I have tried adding

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

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

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
    }
}

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: enter image description here

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.

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

Thanks!

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

For Maven sources and docs the only thing I have found is to change the default settings.

File -> Other Settings -> Default Settings... -> Maven -> Importing

Checking the boxes to download Sources and Documentation settings thumb


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...