Search code examples
xamarinxamarin.android

Xamarin Android - Optimising code causes App to crash


VS 2019 - Xamarin 4.8

In the PCL Project I have the Optimize Code checkbox checked.

In the Android Project, if I check the Optimize Code checkbox, the App crashes immediately on start up. If I don't have it checked, it works fine.

Question: Is ticking the Optimize Code checkbox in the Android Project required if it is already ticked in the PCL project? (to produce optimised code)

I have tried the options from this page: https://forums.xamarin.com/discussion/55666/app-runs-in-debug-mode-crashes-in-release-mode


Solution

  • Changing the "Code Shrinker" option from blank to r8 seems to have fixed the issue. In case others are having a similar issue, here are my "Android Options": enter image description here

    And here are by Android Build settings: enter image description here