dokka icon indicating copy to clipboard operation
dokka copied to clipboard

dokkaHtmlMultiModule does not working when project has android module

Open takahirom opened this issue 4 years ago • 1 comments

Thanks for the cool documentation tools!

Describe the bug With the android module, the dokkaHtmlMultiModule task succeeds, but the documentation is empty.

Expected behaviour The document is generated.

To Reproduce

You can check run forked Android0GradleIntegrationTest https://github.com/Kotlin/dokka/compare/master...takahirom:can-not-dokkaHtmlMultiModule?expand=1

Project module structure.

root
 ┗ app

Dokka configuration Mostly similar to the one used in integration tests. https://github.com/Kotlin/dokka/compare/master...takahirom:can-not-dokkaHtmlMultiModule?expand=1

Installation

  • Operating system: macOS

  • Build tool: image

  • Dokka version: 1.4.30

Additional context It is not generated by dokkaHtmlMultiModule, but it seems that dokkaHtml in the module does not work if the plugin is applied in the root project. The above will not be reproduced if the plugin is not adapted in the root project. https://github.com/Kotlin/dokka/commit/b8cca436ea04add6d08b65cffbd9fcb161daa3f8

takahirom avatar Apr 08 '21 11:04 takahirom

Probably this issue is related to https://github.com/Kotlin/dokka/issues/1463

takahirom avatar Jun 01 '21 02:06 takahirom

Hi, thanks for the report. From looking at your branch it appears you removed the Kotlin and Android plugins from the root project, and only applied them to the subproject.

https://github.com/Kotlin/dokka/compare/master...takahirom:dokka:can-not-dokkaHtmlMultiModule

Image

Unfortunately, this means the buildscript classpath across the project is inconsistent. Dokka will be unable to access classes in the Kotlin and Android plugin. This is a Gradle issue that Dokka Gradle plugin cannot influence.

There are a few ways to work around this:

  • Apply all plugins in the root plugin, with apply false.
  • Use a convention plugin project, and add the plugins as dependencies https://docs.gradle.org/8.14/samples/sample_convention_plugins.html#applying_an_external_plugin_in_precompiled_script_plugin
  • Define the plugins in settings.gradle.kts https://docs.gradle.org/8.14/userguide/plugins.html#sec:plugin_management

If there's anything I've missed, please reply with more information. It would help to have the full error message or Gradle log output, and a direct link to the project (or attach a zip to the project.)

adam-enko avatar Jun 05 '25 14:06 adam-enko