Uploaded image for project: 'Qt Tools for Android'
  1. Qt Tools for Android
  2. QTTA-411

Distribute Java API docs via AAR

XMLWordPrintable

    • Icon: User Story User Story
    • Resolution: Unresolved
    • Icon: P2: Important P2: Important
    • None
    • None
    • QtGP: General

      Why?

      Cause

      • The user needs to see API documentation right inside Android Studio
      • The user will see argument names as a hint as well for all public Qt Quick for Android Java APIs

      Customer

      • If any for this?

      Cruft

      • Why this would not be needed?

      What?

      Definition

      • Currently, the AAR files built in the Quick for Android project include .jar files but do not include corresponding source or documentation JARs. As a result:
        • Android Studio cannot display Java/Kotlin documentation for Qt-provided Java classes.
        • Method argument names are not visible in the editor or auto-completion (they show as arg0, arg1, etc.).
        • This limits the development experience and makes integration harder for developers relying on Qt's Java APIs like QtQuickView and all other classes that it references.

      Proposed Solution:

        1. Change AAR Delivery Format
          Deliver the AAR in a local directory that mimics a Maven repository structure. This will allow Android Studio to automatically associate -sources.jar }} with the binary {{.aar and .jar artifacts. Currently, the AAR dependency gets added by QtGP under the hood. QtGP can change the way of AAR inclusion after this change.
        1. Enhance Qt Module Installations
          Modify Qt modules that install .jar files to also support installing the corresponding Java source files, enabling generation of a *-sources.jar. In the scope of Quick for Android, adding qtbase and qtdeclarative Java sources would suffice.
        1. Extend AAR Build Process
          Enhance the AAR build logic to also generate a *-sources.jar alongside the main AAR.

      Optionally, support generation of a *-javadoc.jar if we can also produce JavaDocs from the sources.

      Benefits:

        • Improved developer experience in Android Studio.
        • Better documentation access and usability of Qt’s Java APIs.

      Impact Scope:

        • Affects AAR packaging.
        • Requires changes in the module install logic across Qt to include Java source files or generate Qt6Foobar-sources.jar along with the original .jar file.
        • Might require agreement on source file locations and how to handle them in the build system.

      Demarcation

      • This is only valid for Qt Quick for Android, not Qt for Android (this approach does not work with Q4A atm)

      Dependencies

      • This needs CI changes QTBUG-138976
      • This is required for Qt Docs to have Javadoc APIs QTBUG-117028

        1. image-2025-07-14-15-46-22-863.png
          473 kB
          Soheil Armin
        2. image-2025-07-14-15-37-12-469.png
          44 kB
          Soheil Armin
        For Gerrit Dashboard: QTTA-411
        # Subject Branch Project Status CR V

            nikunj Nikunj Arora
            soarmin Soheil Armin
            Votes:
            4 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:

                There is 1 open Gerrit change