Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove Jetifier - migrate to AndroidX - Gradle build slowdown #609

Open
Woren opened this issue Jan 16, 2025 · 7 comments · May be fixed by #610
Open

Remove Jetifier - migrate to AndroidX - Gradle build slowdown #609

Woren opened this issue Jan 16, 2025 · 7 comments · May be fixed by #610
Labels
bug Something isn't working

Comments

@Woren
Copy link

Woren commented Jan 16, 2025

Describe the bug

Please migrate Readium from Support Library to AndroidX so android.enableJetifier=true is not any more needed. You can check if this is needed using Build Analyzer tool inside Android Studio. Migration guide is available here. It should be hopefully easy process.

Why it matters?
Enabled Jetifier is significatly impaction build times of the Gradle project based on our experiences with other libraries before/after migration to AndroidX.

Thank you very much.

How to reproduce?

Measure your build time before adding Readium library to your project.
Set android.enableJetifier=true in Gradle project settings.
Measure your build time after.

Readium version

3.0.3

Android API version

23 and higher

Additional context

No response

@Woren Woren added bug Something isn't working triage Triage needed by maintainers labels Jan 16, 2025
@mickael-menu
Copy link
Member

We are aware of this issue, but we cannot remove android.enableJetifier because it is required by one of our third-party dependencies (com.github.barteksc:pdfium-android) which currently lacks a suitable open-source replacement.

@mickael-menu mickael-menu closed this as not planned Won't fix, can't repro, duplicate, stale Jan 16, 2025
@mickael-menu mickael-menu removed the triage Triage needed by maintainers label Jan 16, 2025
@mickael-menu
Copy link
Member

Maybe there's a way to Jetify manually the JAR of pdfium-android. This dependency is not maintained anymore, so we could import the JAR directly. Does anybody have experience with that?

@mickael-menu
Copy link
Member

@mickael-menu mickael-menu reopened this Jan 16, 2025
@mickael-menu mickael-menu linked a pull request Jan 16, 2025 that will close this issue
@mickael-menu
Copy link
Member

@Woren Could you test out this PR? Thanks #610

@Woren
Copy link
Author

Woren commented Jan 17, 2025

Firstly thank you for the quick reply!

If I understand this correctly I need to clone mentioned branch (PR) and use it directly? So there are no snapshot builds of this branch?

Also for the future release (if this is merged) we will need to still use cloned repo of main branch or it will work with produced *.aar downloaded from maven? If not build times should be likely better that using Jetifier but there will be some overhead still (hopefully mostly elimined using Gradle cache etc.).

@mickael-menu
Copy link
Member

You need to clone the branch directly.

But if I understand correctly, removing Jetifier will have an impact if you were using the Readium toolkit and compiling it yourself as a local clone (see our README) instead of using Maven Central. In your case, I'm not sure you will see much difference? Gradle caches jetified artifacts pulled from Maven Central so unless you clear your Gradle cache regularly it should not have much impact.

In any case this will work with Maven Central. If not, we will revert back these changes.

@Woren
Copy link
Author

Woren commented Jan 23, 2025

Sorry for little delay. Adding the cloned depedency and syncing project parameters wasn't that straight forward for us.

So in the end it should be working if we didn't mess up something with those dependencies and caches from previous builds. The property "android.enableJetifier" is set to false for our project.

Also in the newly produced jar file of pdfium you can clearly see that "support library" imports are gone and are replaced with "androidx".

In my option this is ready to be merger and thank you for your effort.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants