Search code examples
androidemailandroid-intentgmaillaunchmode

Email intent closes application


I am facing a weird behavior in my app. I have an email chooser so the user can pick the mail client he wants to send an email.

In debug mode when I picked an email client (e.g. gmail), and press back everything works fine and I am navigated to the Activity that launched the email client.

But when I run the app it in release application closes when the chooser dialog appears and the final application that I was running before my app is shown in the background (e.g. Facebook).

I have tried to set all kind of launchmodes for the launching activity. The two that behave as desired, at least in debug mode, are standard and singletop.

Has anyone any idea how can I solve this issue?


Solution

  • After using AppDomain.CurrentDomain.UnhandledException I saw that I had an unhandled exception in aCirclePageIndicator, which I was using in my activity, that was giving an System.MethodAccessException. This answer gave me the solution I needed. Everything works flawlessly now.