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
Generate ELF shared libraries and allow multi-abi libs in APKs and App bundles #33696
Conversation
Wondering what this change does to APK size. From the diff in the description it looks like it adds ~220KiB compressed? |
I tried building a default template app with The regular APK was 5.23MB and the The uncompressed Note that we had to disable the debug symbol stripping that Android usually does to |
Is the size increase likely due to the debug symbols? |
FYI: the config to avoid stripping debug symbols does not work in Flutter modules. It seems that the root cause is that the Gradle plugin is inserted as an implementation dependency: dependencies {
implementation project(':flutter')
} In which, any config set in the We may need to land a fix for dart-lang/sdk#37146 before this one goes in. |
The CI seems to be running into: https://github.com/dart-lang/sdk/blob/a6bbc58d09569ed84f437d6ff55c01166745b3d4/runtime/vm/dart_api_impl.cc#L6075. The target is still |
6af89f8
to
0dcfa51
Compare
Pending AIs:
|
|
@tvolkert I think https://github.com/flutter/engine/pull/9190/files will fix it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Other than a few nits, LGTM
There's a check before that. I have updated both error messages, so it's more clear. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@@ -111,21 +144,53 @@ class FlutterPlugin implements Plugin<Project> { | |||
return result | |||
} | |||
|
|||
/** | |||
* Returns the platform that is used to extract the `libflutter.so` and the .class files. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this really used to used to extract libflutter.so
? It looks like it's only used to extract the .class
files.
If I'm mis-reading it (and it is used to extract libflutter.so
), is it not a problem that it's returning PLATFORM_ARM64
if that's merely one of the target platforms?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It extracts libflutter.so
as well, then it adds the libflutter.so
for the rest of the ABIs.
Alternatively, we could extract the .class
only before the afterEvaluate
block (otherwise Gradle complains that we are referencing classes that aren't defined).
I filed an issue to track this in #33059 and #33064
The current engine artifacts for Android are:
android-arm/
android-arm-profile/
android-arm-release/
android-arm64/
android-arm64-profile/
android-arm64-release/
android-x64/
android-x86/
x64
and x86
are for debug only, and their corresponding libflutter.so
is always added even for arm
and arm64
.
This change has doubled the measured size in the basic_material_app_android__compile benchmark. |
@jonahwilliams that's intended. Looks like the goal/baseline is defined in a db? |
…p bundles (flutter#33696) * Gradle generates ELF shared libraries instead of AOT snapshots. * `flutter build apk/appbundle` supports multiple `--target-platform` and defaults to `android-arm` and `android-arm64`. * `flutter build apk` now has a flag called `--split-per-abi`.
…s and App bundles (flutter#33696)" (flutter#34121)
Description
Include ELF shared library instead of AOT snapshots in APKs and make the flag
target-platform
multi-option forbuild apk
andbuild appbundle
.After this change, an APK built for release or profile will have the following structure:
Fat APK
The tool displays a message:
Resulting APK:
ABI split per APK
This will generate two APKs with the appropriate version for the the Play Store:
Related Issues
#18494
#31922
Tests
Checklist
Before you create this PR confirm that it meets all requirements listed below by checking the relevant checkboxes (
[x]
). This will ensure a smooth and quick review process.///
).flutter analyze --flutter-repo
) does not report any problems on my PR.Breaking Change
Does your PR require Flutter developers to manually update their apps to accommodate your change?