Skip to content

Implement coreLibraryDesugaring feature#3797

Open
jewelshkjony wants to merge 5 commits intomit-cml:masterfrom
jewelshkjony:feature-add/core-library-desugaring
Open

Implement coreLibraryDesugaring feature#3797
jewelshkjony wants to merge 5 commits intomit-cml:masterfrom
jewelshkjony:feature-add/core-library-desugaring

Conversation

@jewelshkjony
Copy link
Contributor

@jewelshkjony jewelshkjony commented Mar 8, 2026

General items:

For all other changes:

  • I branched from master
  • My pull request has master as the base

What does this PR accomplish?

This PR integrates coreLibraryDesugaring into the App Inventor build pipeline. It enables the use of modern Java 8+ APIs (such as java.time, java.util.stream, and default interface methods) while maintaining compatibility with older Android devices.

Key Changes:

  • New Annotation: Added @UsesCoreLibraryDesugaring to allow components or extensions to signal when the desugaring process is required.
  • Toolchain Updates:
    • Integrated latest desugar_jdk_libs-2.1.5.jar and its configuration JAR.
    • Updated D8.java to support the --desugared-lib flag.
    • Implemented L8.java to handle the dexing and shrinking of the desugar library itself.
  • Build Pipeline: Modified the build logic to ensure the desugared library classes are correctly bundled into both APK and AAB outputs.

Performance Impact:

  • APK Size: I observed an increase of approximately 1.01 MB± when desugaring is enabled.
  • Build Time: It takes a few seconds extra to build the project when desugaring is enabled. (Extra 4 seconds in my test)

This change is particularly beneficial for extension developers, as it allows them to leverage modern Java features without worrying about manual backporting or breaking apps on older handsets.

Test Results:

Tested with a sample extension utilizing java.time and confirmed it runs perfectly.

image

Resolves # .
#3791

@AppInventorWorkerBee
Copy link
Collaborator

Can one of the admins verify this patch?

1 similar comment
@AppInventorWorkerBee
Copy link
Collaborator

Can one of the admins verify this patch?

@jewelshkjony
Copy link
Contributor Author

@AppInventorWorkerBee ok to test

@MahmoudHooda2019
Copy link

Great work @jewelshkjony
Waiting for this future 😊

@jisqyv
Copy link
Member

jisqyv commented Mar 8, 2026

@AppInventorWorkerBee ok to test

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants