How to get Android Studio to load dependencies from sources and javadoc?

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

But that did not work for me. Perhaps this is because they belong to IntelliJ Idea, and I have a problem with Android Studio.

I tried to add

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

Both for the root build.gradle file (I'm in the multiproject setup) or in the build.gradle file of the application.

My Gradle file application:

 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 the screen, saying that there are no sources. If I click the "Attach" button, it will show: enter image description here

As you can see, only the lib jar was loaded into the Gradle cache. * -Sources.jar or * -javadoc.jar files not loaded. I cleaned up the project, deleted the .gradle folder to make it boot again from maven. Bad luck.

I double-checked that the downloaded generic image contains the sources and javadoc available in maven, so this is not a problem.

Thank!

+52
android android-studio maven gradle
Jul 02 '13 at 13:14
source share
6 answers

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

Old answer:

As we talk about an early preview, the simplest fix wins.

For now, just add them to your project in the Project Structure dialog box. This is even worse, since now Android Studio will deprive module files (iml) from all dependencies that are not related to Android Gradle's own settings and tasks, for example. the module has a dependency on robolectric and an additional task, and the config localTest is added to build.gradle. After you open Android Studio, it will remove the dependency, you need to add it again.

At the moment, I am saving the iml files and the .idea folder in my git. After launch

 git checkout myproject/myproject.iml 
+3
Jul 03 '13 at 9:52 on
source share

For Maven sources and documents, the only thing I found was to change the default settings.

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

Check Fields for Download Sources and Documentation thumb settings

+9
Dec 27 '14 at 20:07
source share

As we can see the answer from Xavier Ducrohet (Android SDK Tech Lead Google Inc.) , as of July 26, 2013:

I do not think Gradle is handling this at this moment. I talked with the developers, and they know about it. We are looking at adding a hook to Gradle so that we can do this when the toolkit API requests a model.

+5
Dec 12 '13 at 21:43
source share

Try this plugin on github . This works for me.

Update: The README.md repository on GitHub now reports:

This plugin is deprecated. In AndroidStudio 1.4, this support is built-in.

+3
Feb 09 '15 at 9:42
source share

Unfortunately, I can not comment on my score, therefore:

Although this is not the answer, if you use the eclipse plugin in Gradle, you can run

 gradle eclipseClasspath 

And it will download all the sources and, I believe, Javadoc and create a .classpath with links to their locations.

Then at least you will have sources and javadoc for the link, which I suppose you can reference in IntelliJ.

+1
Jul 03 '13 at 9:17
source share

You should try using the gradle idea plugin. Just add this to your build.gradle file. You will find the documents here.

 apply plugin: 'idea' idea { module { downloadJavadoc = true downloadSources = true } } 
-2
Jul 03 '13 at 6:58
source share



All Articles