android: Debug symbols upload on Google Play Console for better crash information

When we upload an app bundle or apk, below warning is returned from google play console. Question is what kind of source symbols should we or can we upload here? I am guessing that it is it not pdb files 😃 Is there a way for Xamarin.forms applications for android to get symbols and better crash information?

This App Bundle contains native code, and you've not uploaded debug symbols. We recommend that you upload a symbol file to make your crashes and ANRs easier to analyse and debug.

image

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Reactions: 3
  • Comments: 27 (17 by maintainers)

Commits related to this issue

Most upvoted comments

@lauxjpn this code https://github.com/xamarin/xamarin-android/pull/6616/files#diff-72a69a14e7fbd5d8f65dce108bf7a0eca31fbbffaea6332ee4232ca020298b3dR27 will always make sure that the mapping.txt file ends up in the publish folder. It will also be auto included in the .aab as well.

@lauxjpn can you send a PR for the dotnet publish issue? We don’t really have a spec on what it’s supposed to do – we took a guess and copied the .aab and .apk files.

Seems like you could add that mapping.txt file to @(_AndroidFilesToPublish) here:

https://github.com/xamarin/xamarin-android/blob/f93d3d810279e7fad87063043fcc2c38b5c25bee/src/Xamarin.Android.Build.Tasks/Microsoft.Android.Sdk/targets/Microsoft.Android.Sdk.Publish.targets#L22-L30

@plaili ok looks like our Task which is responsible for calling the build-bundle command on bundletool does not support additional arguments. It seems that the --metadata-file argument has been added recently.

The AndroidBundleToolExtraArgs is only used when we call build-apks. So we are going to need to add this feature. I’ll take a. look, we will probably add a AndroidBundleMetaDataFile ItemGroup which might look like

<ItemGroup>
<AndroidBundleMetaDataFile Include="com.android.tools.obfuscation/mapping.txt:$(OutputPath)mapping.txt" />
</ItemGroup>

I’ll talk this over with @jonathanpeppers and see if we can come up with an easy way to handle this.

@lauxjpn you should be able to use $(OutputPath) if you set your property after this line:

<Import Project="$(MSBuildExtensionsPath)\Xamarin\Android\Xamarin.Android.CSharp.targets" />
<PropertyGroup>
  <AndroidProguardMappingFile>$(OutputPath)mapping.txt</AndroidProguardMappingFile>
</PropertyGroup>

It seems like we should maybe set $(AndroidProguardMappingFile) by default – so you don’t have to do this at all?

The AndroidProguardMappingFile only works with r8 / d8. It should output the mapping if those are set.

VS 2019 16.7.x does not include the fix from #5304 since it was released before the fix was merged. You will need to be on 16.9.x. Also PR #5318 made it an ā€œopt-inā€ feature. Which means you need to set the following in your release config in the csproj in order to activate it.

<AndroidProguardMappingFile>$(OutputPath)mapping.txt</AndroidProguardMappingFile>

This was solved for obfuscated Java/Kotlin code here:

https://github.com/xamarin/xamarin-android/pull/5304

It doesn’t look like we have solved this for native code, which would include AOT’d .NET assemblies.