Skip to content

Fixes symbolication for net9.0-android applications in Release config #4221

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

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

jamescrosswell
Copy link
Collaborator

@jamescrosswell jamescrosswell commented May 27, 2025

Resolves #4209:

Testing

I ran into some challenges creating some automated tests for this. I think we should release this fix ASAP then and I've created #4227 to address the tests:

References

@jamescrosswell jamescrosswell marked this pull request as ready for review May 28, 2025 10:39
Copy link
Member

@bruno-garcia bruno-garcia left a comment

Choose a reason for hiding this comment

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

Should we test this on Symbol Collector Android?

internal static string GetArchivePathForAbi(this string archivePath, string abi, DebugLogger? logger)
{
var basePath = Path.GetDirectoryName(archivePath) ?? string.Empty;
var abiPart = abi.Replace("-", "_");
Copy link
Member

Choose a reason for hiding this comment

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

I wonder if we can avoid this by having supportedAbis be provided in the right format

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The abi.Replace("-", "_") you mean? Not really... most of the time it is used with a hyphen. When building the file names for the split_config APKs though it gets replaced with an underscore (I'm sure there's a reason... not sure what it is though).

{
var basePath = Path.GetDirectoryName(archivePath) ?? string.Empty;
var abiPart = abi.Replace("-", "_");
var splitFilePath = Path.Combine(basePath, $"split_config.{abiPart}.apk");
Copy link
Member

Choose a reason for hiding this comment

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

if GetDirectoryName returned null and we ended up with "" does this code make sense?

@jamescrosswell
Copy link
Collaborator Author

jamescrosswell commented May 29, 2025

Should we test this on Symbol Collector Android?

That might give a bit of reassurance yes. I've only tested it manually on the Sentry.Samples.Maui project so far.

I've tested both with <AndroidUseAssemblyStore> set to both True and False with both Debug and Release configs now.

I also tested what happens when using the bundletool to split the packages and install these on a simulator (rather than using the MAUI build targets to install the app), since the bundletool apparently does exactly what GooglePlay would do... like so:

  1. bundletool get-device-spec --output=device-spec.json
  2. bundletool build-apks --bundle=io.sentry.dotnet.samples.maui-Signed.aab --output=my_app.apks --device-spec=device-spec.json
  3. bundletool install-apks --apks=my_app.apks

Curiosly after step two, the *.apks (APK set) contains the following files:

base-arm64_v8a.apk	base-en.apk		base-master.apk		base-xxhdpi.apk

However after step 3, what gets installed on the simulator is:

base.apk  lib  oat  split_config.arm64_v8a.apk  split_config.en.apk  split_config.xxhdpi.apk

So obviously some renaming happens during installation. None the less, it seems like the device specific file that contains the assemblies we want will always be named split_config.[arch].apk, which is the assumption made here:

var splitFilePath = Path.Combine(basePath, $"split_config.{abiPart}.apk");

@bruno-garcia
Copy link
Member

we could also ask @romtsn or @markushi for them to review your conclusion and if they have any further insight if that helps give some confidence

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

MAUI Android Line Numbers & File Names Don't Appear in .NET 9 (But They Do in .NET 8)
3 participants