14

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?

cнŝdk
  • 31,391
  • 7
  • 56
  • 78
Romulus Urakagi Ts'ai
  • 3,699
  • 10
  • 42
  • 68
  • Do the javadoc jar you see in the repo installed have content? Did you unpack them to verify it? – Opal Jun 18 '15 at 07:24
  • Yes, it has correct contents in it. I unpacked it to check. This is the unpacked root. http://my.jetscreenshot.com/18082/20150618-5xfz-44kb.jpg – Romulus Urakagi Ts'ai Jun 18 '15 at 07:38

2 Answers2

6

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(?)
Community
  • 1
  • 1
HELOX
  • 529
  • 2
  • 13
  • Didn't work :/ By the way the support library in local Maven repo shows sources without problem, and when I compare the file structure I can't find difference. Weird. – Romulus Urakagi Ts'ai Jun 22 '15 at 01:16
0

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

Vouskopes
  • 167
  • 1
  • 4