-
Notifications
You must be signed in to change notification settings - Fork 524
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
Debug symbols upload on Google Play Console for better crash information #5378
Comments
This was solved for obfuscated Java/Kotlin code here: It doesn't look like we have solved this for native code, which would include AOT'd .NET assemblies. |
I'm seeing the same issue when uploading a bundle build via VS2019. Is there a file somewhere that can be uploaded? I also still get the deobfuscation message noted in 5186 even though I'm not using a code shrinker. |
@tbrentlong as mentioned in #5304, I think you would need to use Can you share a screenshot of the warning you get? |
I'm getting the same issue here, i cannot find the mapping.txt in the bin/Release folder, and i don't know where to change the cfg file either. Microsoft Visual Studio Community 2019 Xamarin 16.7.000.456 (d16-7-6@f8d55b6) Xamarin.Android SDK 11.0.2.0 (d16-7/025fde9) |
VS 2019 16.7.x does not include the fix from #5304 since it was released before the fix was merged.
|
Thank you for the information, will try to update and post my findings... Do i need to activate Proguard code shrinking for the mappings to be outputted? |
The |
Is this issue with no debug symbols for native code tracked anywhere? Or will it be tracked here? |
Those are better. it actually already works like @dellis1972 suggested. I can see the file is generated. |
The mapping.txt is fine, it's generated here, too, but for native code there is still something missing as far as I understand it. At least I still see the warning. |
@dellis1972 @jonathanpeppers this works fine in my local build. I can see the mapping.txt but in Azure Devops Pipelines, I am not seeing it it is generated. Is there any difference? |
Hi, it doesn't seem to be working for me. Settings: bundle, d8 Dex, r8 code shrinker (VS 16.11.5 & Xamarin.Android 11.4.0.5). If I put "-keepattributes SourceFile,LineNumberTable -printmapping mapping.txt" in the proguard config file and I get the following error when I build the app:
If I have put $(OutputPath)mapping.txt in the Android Project Properties then I get the mapping.txt file outputted but when I try Archiving the project (after a successful build) I get the following error:
Am I missing something or is it still an issue? Thanks |
There are a couple of issues in regards to the 1. The AndroidProguardMappingFile docs are incorrect in regards to the default value:
There is no default value. If the property is not explicitly set, no mapping file will be created. 2. The AndroidProguardMappingFile docs are misleading in regards to the value of
|
@lauxjpn you should be able to use <Import Project="$(MSBuildExtensionsPath)\Xamarin\Android\Xamarin.Android.CSharp.targets" />
<PropertyGroup>
<AndroidProguardMappingFile>$(OutputPath)mapping.txt</AndroidProguardMappingFile>
</PropertyGroup> It seems like we should maybe set |
@jonathanpeppers Ah, you're right that should work! I think it makes sense to have In case the mapping file generation is a performance hit, it might also make sense to introduce a simple flag property that when |
I am trying to include the mapping.txt in my aab bundle: |
@plaili ok looks like our Task which is responsible for calling the The
I'll talk this over with @jonathanpeppers and see if we can come up with an easy way to handle this. |
For reference
|
It seems like we could define these two by default if <!-- PropertyGroup -->
<AndroidProguardMappingFile>$(OutputPath)mapping.txt</AndroidProguardMappingFile>
<!-- ItemGroup-->
<AndroidAppBundleMetaDataFile Include="$(AndroidProguardMappingFile)" /> |
Context dotnet#5378 Provide a default value for `AndroidProguardMappingFile` when using `AndroidLinkTool=r8`. Add support for providing meta-data files to `bundletool` when building the app bundle. This allows developers to provide additional meta-data such as the proguard mapping file. The new ItemGroup is called `AndroidAppBundleMetaDataFile`.
@plaili where did you find the value for the |
Never mind, I found it should be |
I am always confused about proguard.map vs. mapping.txt, but as you write they seem to be the same thing and must just be named accordingly in different situations. |
Context dotnet#5378 Provide a default value for `AndroidProguardMappingFile` when using `AndroidLinkTool=r8`. Add support for providing meta-data files to `bundletool` when building the app bundle. This allows developers to provide additional meta-data such as the proguard mapping file. The new ItemGroup is called `AndroidAppBundleMetaDataFile`.
Context dotnet#5378 Provide a default value for `AndroidProguardMappingFile` when using `AndroidLinkTool=r8`. Add support for providing meta-data files to `bundletool` when building the app bundle. This allows developers to provide additional meta-data such as the proguard mapping file. The new ItemGroup is called `AndroidAppBundleMetaDataFile`.
Context dotnet#5378 Add a new property `AndroidCreateProguardMappingFile` to control the creation of the proguard mapping file. This will default to `False` because it does has some impact on the final apk sizes. Also Provide a default value for `AndroidProguardMappingFile` when using `AndroidLinkTool=r8` and `AndroidCreateProguardMappingFile=True`. Add support for providing meta-data files to `bundletool` when building the app bundle. This allows developers to provide additional meta-data such as the proguard mapping file. The new ItemGroup is called `AndroidAppBundleMetaDataFile`.
Context dotnet#5378 Add a new property `AndroidCreateProguardMappingFile` to control the creation of the proguard mapping file. This will default to `False` because it does has some impact on the final apk sizes. Also Provide a default value for `AndroidProguardMappingFile` when using `AndroidLinkTool=r8` and `AndroidCreateProguardMappingFile=True`. Add support for providing meta-data files to `bundletool` when building the app bundle. This allows developers to provide additional meta-data such as the proguard mapping file. The new ItemGroup is called `AndroidAppBundleMetaDataFile`.
Context dotnet#5378 Add a new property `AndroidCreateProguardMappingFile` to control the creation of the proguard mapping file. This will default to `False` because it does has some impact on the final apk sizes. Also Provide a default value for `AndroidProguardMappingFile` when using `AndroidLinkTool=r8` and `AndroidCreateProguardMappingFile=True`. Add support for providing meta-data files to `bundletool` when building the app bundle. This allows developers to provide additional meta-data such as the proguard mapping file. The new ItemGroup is called `AndroidAppBundleMetaDataFile`.
Context dotnet#5378 Add a new property `AndroidCreateProguardMappingFile` to control the creation of the proguard mapping file. This will default to `False` because it does has some impact on the final apk sizes. Also Provide a default value for `AndroidProguardMappingFile` when using `AndroidLinkTool=r8` and `AndroidCreateProguardMappingFile=True`. Add support for providing meta-data files to `bundletool` when building the app bundle. This allows developers to provide additional meta-data such as the proguard mapping file. The new ItemGroup is called `AndroidAppBundleMetaDataFile`.
For APK builds, the <!-- Copy mapping.txt file to publish directory. -->
<Target Name="PublishAndroidProguardMappingFile"
AfterTargets="_CalculateAndroidFilesToPublish"
BeforeTargets="CopyFilesToPublishDirectory"
Inputs="$(AndroidProguardMappingFile)"
Outputs="$(PublishDir)$([System.IO.Path]::GetFileName('$(AndroidProguardMappingFile)'))"
Condition="'$(AndroidProguardMappingFile)' != '' And
Exists('$(AndroidProguardMappingFile)') And
($(AndroidPackageFormats.Contains('apk')) Or '$(AndroidPackageFormat)' == 'apk')">
<ItemGroup>
<ResolvedFileToPublish Include="$(AndroidProguardMappingFile)"
RelativePath="$([System.IO.Path]::GetFileName('$(AndroidProguardMappingFile)'))" />
</ItemGroup>
</Target> |
@lauxjpn can you send a PR for the Seems like you could add that |
I'm including a fix for the |
@dellis1972 It might be worth copying the file to the publish directory independent of the used package format, because services like Microsoft AppCenter might depend on it for diagnostics. According to Android Deobfuscation: Uploading the mapping.txt file, this should indeed be the case:
However, for my Android apps in AppCenter, I only see the subsections Maybe someone from the AppCenter team can clarify this. |
Fixes: dotnet#5378 Context: 2dab2bc When uploading an `.apk` or `.aab` file which contains native libraries such as AOT'd .NET assemblies to the Google Play store, the Google Play Console reports the following warning: > 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. Commit 2dab2bc addresses a similar warning regarding obfuscated Java/Kotlin code. Improve support for this scenario by adding a new `$(AndroidCreateProguardMappingFile)` MSBuild property which controls the creation of the ProGuard mapping file. When True (the default when r8 is used), a ProGuard mapping file will be created and added to `.apk`/`.aab` build outputs. This increases the size of resulting applications by ~1% for our unit tests, and will remove the above warning for Google Play Store submissions. To make `$(AndroidCreateProguardMappingFile)`=True *work*, add support for a new `@(AndroidAppBundleMetaDataFile)` item group. `%(AndroidAppBundleMetaDataFile.Include)` values are those used by the [`bundletool build-bundle --metadata-file`][0] option: > `--metadata-file=target-bundle-path:local-file-path` > > * `target-bundle-path` specifies a path relative to the root of > the app bundle where you would like the metadata file to be > packaged, and > * `local-file-path` specifies the path to the local metadata file > itself. When `$(AndroidCreateProguardMappingFile)`=True, we automatically add: <AndroidAppBundleMetaDataFile Include="com.android.tools.build.obfuscation/proguard.map:$(AndroidProguardMappingFile" /> which causes the ProGuard mapping file to be included into the bundle. This only applies to `.aab` package formats. For `.apk` files the ProGuard mapping file will not be included in the `.apk`, as it doesn't not support it. However the file will be copied to the `$(OutputPath)` along with the `.apk`. It can be manually uploaded to the Google Play Store from there. [0]: https://developer.android.com/studio/build/building-cmdline#bundletool-build
@lauxjpn this code https://github.com/xamarin/xamarin-android/pull/6616/files#diff-72a69a14e7fbd5d8f65dce108bf7a0eca31fbbffaea6332ee4232ca020298b3dR27 will always make sure that the |
…6616) Fixes: #5378 Context: 2dab2bc When uploading an `.apk` or `.aab` file which contains native libraries such as AOT'd .NET assemblies to the Google Play store, the Google Play Console reports the following warning: > 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. Commit 2dab2bc addresses a similar warning regarding obfuscated Java/Kotlin code. Improve support for this scenario by adding a new `$(AndroidCreateProguardMappingFile)` MSBuild property which controls the creation of the ProGuard mapping file. When True (the default when r8 is used), a ProGuard mapping file will be created and added to `.apk`/`.aab` build outputs. This increases the size of resulting applications by ~1% for our unit tests, and will remove the above warning for Google Play Store submissions. To make `$(AndroidCreateProguardMappingFile)`=True *work*, add support for a new `@(AndroidAppBundleMetaDataFile)` item group. `%(AndroidAppBundleMetaDataFile.Include)` values are those used by the [`bundletool build-bundle --metadata-file`][0] option: > `--metadata-file=target-bundle-path:local-file-path` > > * `target-bundle-path` specifies a path relative to the root of > the app bundle where you would like the metadata file to be > packaged, and > * `local-file-path` specifies the path to the local metadata file > itself. When `$(AndroidCreateProguardMappingFile)`=True, we automatically add: <AndroidAppBundleMetaDataFile Include="com.android.tools.build.obfuscation/proguard.map:$(AndroidProguardMappingFile" /> which causes the ProGuard mapping file to be included into the bundle. This only applies to `.aab` package formats. For `.apk` files the ProGuard mapping file will not be included in the `.apk`, as it does not support it. However, the file will be copied to `$(OutputPath)` along with the `.apk`. It can be manually uploaded to the Google Play Store from there. [0]: https://developer.android.com/studio/build/building-cmdline#bundletool-build
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.
The text was updated successfully, but these errors were encountered: