Skip to content

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

Merged
kotlarmilos merged 1 commit into
dotnet:mainfrom
kotlarmilos:bugfix/strip-android-coreclr-sample
May 29, 2025
Merged

[Android] Re-enable native symbol stripping in the release build of the sample app#116061
kotlarmilos merged 1 commit into
dotnet:mainfrom
kotlarmilos:bugfix/strip-android-coreclr-sample

Conversation

@kotlarmilos

Copy link
Copy Markdown
Member

Description

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

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

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 Only use for closed issues 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
@dotnet-policy-service

Copy link
Copy Markdown
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

@matouskozak matouskozak left a comment

Copy link
Copy Markdown
Member

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

kotlarmilos commented May 29, 2025

Copy link
Copy Markdown
Member Author

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
Copy Markdown
Member Author

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

@matouskozak

matouskozak commented May 29, 2025

Copy link
Copy Markdown
Member

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.

Labels

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants