Repository navigation
fix(bgp): package local jars of embedded libraries into the AAR - #512
Open
KisaneNeko wants to merge 2 commits into
Open
KisaneNeko wants to merge 2 commits into
KisaneNeko wants to merge 2 commits into
Conversation
callstack#417 dropped the merge of classes from each library's libs/*.jar (it only ran for minified builds before), so host apps crashed with NoClassDefFoundError. Merge them in every variant, leaving out the jar's root module-info.class. Refs callstack#489
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Refs #489
Problem
Classes from a library's local jars (
implementation files("libs/x.jar")) are missing from the brownfield AAR, so the host app crashes withNoClassDefFoundError. They were merged only for minified builds, and #417 dropped even that:MergeClassesTaskonly receives each library'sclasses.jar.Change
VariantTaskProvider.mergeClasses: also pass each exploded library'slibs/*.jartoMergeClassesTask, as afileTreeso it is read after the AAR is exploded on a clean build. Now done in every variant.MergeClassesTask: leave out a jar's rootmodule-info.class.MergeClassesLocalJarsTest: configures the task before the jar exists and checks its classes reach the javac output. Fails onmain.2.0.0-alpha12(yarn brownfield:plugin:version:sync). Meant to merge before fix(bgp): merge res/values of embedded libraries instead of overwriting #513 (alpha13); if fix(bgp): merge res/values of embedded libraries instead of overwriting #513 goes first, rebase and bump toalpha14.Verified with a local RN library that ships a jar in
android/libs: onmainthe class is missing from the AAR, with the change the consumerAndroidAppcalls it at startup and Detox E2E passes for vanilla, Expo 58 and Expo 57.Apps that already have those classes, because they added the jar themselves or depend on a library the jar bundles, now fail with duplicate classes and need to remove their copy (also in the changeset).
Not covered
META-INF/of the jars is still dropped (also before fix: wire merge classes to asm transformer #417), so a jar that relies onMETA-INF/serviceswon't be found byServiceLoader.