Skip to content

[Android] Re-enable native symbol stripping in the release build of the sample app #116061

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

Merged

Conversation

kotlarmilos
Copy link
Member

Description

This PR fixes size on disk regression introduced in #114148.

@Copilot Copilot AI review requested due to automatic review settings May 28, 2025 08:59
@kotlarmilos kotlarmilos self-assigned this May 28, 2025
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR re-enables native symbol stripping in the release build for the Android sample app to address a size on disk regression.

  • Re-adds the property in the AndroidSampleApp.csproj file for Release configurations.

@github-actions github-actions bot added the needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners label May 28, 2025
@kotlarmilos kotlarmilos added area-Infrastructure-coreclr and removed needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners labels May 28, 2025
@kotlarmilos kotlarmilos added this to the 10.0.0 milestone May 28, 2025
Copy link
Contributor

Tagging subscribers to this area: @hoyosjs
See info in area-owners.md if you want to be subscribed.

@kotlarmilos kotlarmilos requested a review from matouskozak May 28, 2025 09:56
Copy link
Member

@matouskozak matouskozak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Have you tried running the startup/size measurements to see what the impact is?

@kotlarmilos
Copy link
Member Author

kotlarmilos commented May 29, 2025

Yes, I confirmed locally that the size reverts to its previous values. Startup should not be changed by this change.

@kotlarmilos kotlarmilos merged commit 4252c8d into dotnet:main May 29, 2025
64 checks passed
@kotlarmilos
Copy link
Member Author

Both SOD and startup have been reverted to their previous values.

@matouskozak
Copy link
Member

matouskozak commented May 29, 2025

Both SOD and startup have been reverted to their previous values.

Nice, I suspect that the additional size caused that slow-down in startup due to the design of AndroidSampleApp

static void unzipAssets(Context context, String toPath, String zipName) {
AssetManager assetManager = context.getAssets();
try (InputStream inputStream = assetManager.open(zipName);
ZipInputStream zipInputStream = new ZipInputStream(new BufferedInputStream(inputStream))) {
ZipEntry zipEntry;
byte[] buffer = new byte[4096];
while ((zipEntry = zipInputStream.getNextEntry()) != null) {
String fileOrDirectory = zipEntry.getName();
File file = new File(toPath, fileOrDirectory);
File parent = new File(file.getParent());
if (zipEntry.isDirectory()) {
file.mkdirs();
continue;
}
else if (!parent.exists()) {
parent.mkdirs();
}
String fullToPath = file.getAbsolutePath();
Log.i("DOTNET", "Extracting asset to " + fullToPath);
int count = 0;
FileOutputStream fileOutputStream = new FileOutputStream(fullToPath);
while ((count = zipInputStream.read(buffer)) != -1) {
fileOutputStream.write(buffer, 0, count);
}
zipInputStream.closeEntry();
}
} catch (IOException e) {
Log.e("DOTNET", e.getLocalizedMessage());
}
}
.

I remember we saw really big difference in release vs debug in the initial measurements caused by this section of the code.

@github-actions github-actions bot locked and limited conversation to collaborators Jun 29, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

2 participants