Does Android strip native debugging symbols?

Jim Borden 20 Reputation points
2023-08-29T23:05:33.3433333+00:00

The Android SDK (NDK) will strip debugging symbols from native libraries going into an application automatically (in fact it is very hard to disable). Therefore I went with the assumption that since Xamarin / .NET Android uses the Android SDK as a backend that this behavior would happen. Is that assumption incorrect? It looks like the unstripped gigantic .so file is being included and we are getting complaints from our users about an increase in APK size. Is there a way (like Xamarin iOS strip native debug symbols) to strip these on build or do I have to pre-strip them before distribution?

Developer technologies | .NET | Xamarin
Developer technologies | .NET | Other
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Anonymous
    2023-08-30T05:50:20.3433333+00:00

    Hello,

    You can enable the ProGuard for Xamarin android.

    Then edit ProGuard Configuration: Open the proguard.cfg file and add the following lines to configure ProGuard to strip native debugging symbols:

    -dontnote
    -dontwarn
    -verbose
    

    For more details, please check ProGuard General Options

    As note:

    • ProGuard might not completely remove all native debugging symbols, but it can significantly reduce their presence in the final APK.
    • Stripping debugging symbols may affect your ability to debug native code in production builds. Make sure you have sufficient logging and monitoring mechanisms in place.

    Best Regards,

    Leon Lu


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.