Dokka - skip generating javadoc for default android packages

Dokka version 0.9.16 will include a bugfix to remove generated files from documentation.

In version 0.9.15, the following commit seemed to address that "Suppress output of android.R and other generated stuff in dokka-android", but apparently after creating the suppresedFiles map with the needed information, it was not really used to filter sourceSets.


UPDATE: Dokka 0.9.16 has been released with the fix, among other improvements.

#224 Filtered out Android generated classes from docs


Here is a working example with Dokka 0.9.16:

task dokka(overwrite: true, type: org.jetbrains.dokka.gradle.DokkaAndroidTask) {
    outputFormat = 'javadoc'
    outputDirectory = "$buildDir/docs"

    // Do not create index pages for empty packages
    skipEmptyPackages = true

    //Do not output deprecated members. Applies globally, can be overridden by packageOptions
    skipDeprecated = false

    //No default documentation link to kotlin-stdlib
    noStdlibLink = false
}

If you use Android then the type is important: org.jetbrains.dokka.gradle.DokkaAndroidTask

Not DokkaTask but DokkaAndroidTask.