14
votes

I have published an artifact with build.gradle below:

uploadArchives {
    repositories {
        mavenDeployer {
            repository(url: "file://maven")
            pom.groupId = 'com.totvnow'
            pom.artifactId = 'tonedetect-lib'
            pom.version = '0.1.0'
        }
    }
}

task androidJavadocs(type: Javadoc) {
    source = android.sourceSets.main.java.srcDirs
    classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
}

task androidJavadocsJar(type: Jar, dependsOn: androidJavadocs) {
    classifier = 'javadoc'
    from androidJavadocs.destinationDir
}

artifacts {
    archives androidJavadocsJar
}

And I successfully get javadoc files files in repo directory:

tonedetect-lib-0.1.0-javadoc.jar
tonedetect-lib-0.1.0-javadoc.jar.md5
tonedetect-lib-0.1.0-javadoc.jar.sha1

But when I use it in another module's build.gradle:

buildscript {
    repositories {
        jcenter()
        maven { url 'somepath\\maven' }
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:1.2.3'
    }
}

allprojects {
    repositories {
        jcenter()
        maven { url 'somepath\\maven' }
    }
}

and

dependencies {
    compile 'com.totvnow:tonedetect-lib:0.1.0'
}

The Javadoc does not pop up when I use Ctrl-Q on a class in the library. Java codes are fine, and when I click on the class Android Studio gives me the decompiled code without any problem. Also, other dependencies such as support library v4 shows Javadoc correctly.

Does anyone know possible reasons?

2
Do the javadoc jar you see in the repo installed have content? Did you unpack them to verify it?Opal
Yes, it has correct contents in it. I unpacked it to check. This is the unpacked root. my.jetscreenshot.com/18082/20150618-5xfz-44kb.jpgRomulus Urakagi Ts'ai

2 Answers

6
votes

I have no Android Studio experience. However after searching on the internet for a bit I found to following things:

  1. This seems to be a know issue. I found some very similar issues and questions: 1, 2, 3, 4, etc.
  2. These things may potentially help to get it working:

    • Applying the idea plugin and configuring it to download the JavaDoc:

      apply plugin: 'idea'
      idea {
          module {
              downloadJavadoc = true
              downloadSources = true
          }
      }
      
    • In Android Studio go to: File -> Other Settings -> Default Settings... -> Maven -> Importing and check the boxes to download the sources and documentation.
    • Use this plugin to overcome the issue that Android Studio does not know how to locate the Gradle sources and javadoc location(?)
0
votes

After step mentioned by HELOX:

  • In Android Studio go to: File -> Other Settings -> Default Settings... -> Maven -> Importing and check the boxes to download the sources and documentation.

Try Invalidate caches and restart Android Studio. That worked for me in Android Studio 1.3.2