Bug 36287 (XF2_Issues) - Android App (Always) Crashes on "StartUp" When Using FormsAppCompatActivity
Summary: Android App (Always) Crashes on "StartUp" When Using FormsAppCompatActivity
Status: RESOLVED NOT_REPRODUCIBLE
Alias: XF2_Issues
Product: Forms
Classification: Xamarin
Component: Forms ()
Version: 2.0.0
Hardware: PC Windows
: --- normal
Target Milestone: ---
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2015-11-26 11:20 UTC by Ahmed Alejo
Modified: 2018-03-16 14:24 UTC (History)
17 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:


Attachments
Test Project (73.04 KB, application/x-zip-compressed)
2016-12-21 01:10 UTC, Samantha Houts [MSFT]
Details


Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED NOT_REPRODUCIBLE

Description Ahmed Alejo 2015-11-26 11:20:47 UTC
App crashes when using FormsAppCompatActivity: it works if switched back to FormsApplicationActivity

´´´
    [Activity(
        Icon = "@drawable/icon_large",
        Label = "Process App",
        Theme = "@style/Theme.AppCompat.Light.NoActionBar",
        MainLauncher = true,
        ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation)]
    public class MainActivity : FormsAppCompatActivity
    {

        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            // Initialize Xamarin Forms engines.
            global::Xamarin.Forms.Forms.Init(this, bundle);
            //FormsAppCompatActivity.ToolbarResource = Resource.Layout.toolbar;
            //FormsAppCompatActivity.TabLayoutResource = Resource.Layout.tabs;
            LoadApplication(new App());
        }
    }
´´´

11-26 13:32:34.960 D/Mono    (17717): Assembly Ref addref Refractored.Xam.Settings[0x5ac784d8] -> Refractored.Xam.Settings.Abstractions[0x5ac78328]: 3
11-26 13:32:34.976 D/Mono    (17717): Assembly Ref addref Refractored.Xam.Settings[0x5ac784d8] -> Mono.Android[0x652f5f70]: 14
11-26 13:32:34.992 D/HardwareRenderer(17717): Profiling hardware renderer
11-26 13:32:35.046 D/Mono    (17717): Assembly Ref addref Opp.Shared.Core[0x5ac36458] -> System.Threading[0x65e2e750]: 3
11-26 13:32:35.054 D/Mono    (17717): Assembly Ref addref Opp.Shared.Core[0x5ac36458] -> SimpleInjector[0x652e4210]: 2
11-26 13:32:35.062 D/libEGL  (17717): loaded /system/lib/egl/libEGL_MRVL.so
11-26 13:32:35.078 D/libEGL  (17717): loaded /system/lib/egl/libGLESv1_CM_MRVL.so
11-26 13:32:35.093 D/libEGL  (17717): loaded /system/lib/egl/libGLESv2_MRVL.so
11-26 13:32:35.101 D/GC      (17717): <tid=17717> OES20 ===> GC Version   : GC Ver SS_rls_pxa988_JB42_R1_RC2_GC13.15 
11-26 13:32:35.101 D/GC      (17717): 
11-26 13:32:35.148 D/OpenGLRenderer(17717): Enabling debug mode 0
An unhandled exception occured.

11-26 13:32:35.562 D/Mono    (17717): Assembly Ref addref Opp.Shared.Core[0x5ac36458] -> System.Reflection[0x66273ea8]: 6
11-26 13:32:35.562 D/Mono    (17717): Assembly Ref addref Opp.Shared.Core[0x5ac36458] -> System.Runtime.Extensions[0x662796c8]: 3
11-26 13:32:52.242 D/Mono    (17717): DllImport attempting to load: '/system/lib/liblog.so'.
11-26 13:32:52.242 D/Mono    (17717): DllImport loaded library '/system/lib/liblog.so'.
11-26 13:32:52.242 D/Mono    (17717): DllImport searching in: '/system/lib/liblog.so' ('/system/lib/liblog.so').
11-26 13:32:52.242 D/Mono    (17717): Searching for '__android_log_print'.
11-26 13:32:52.242 D/Mono    (17717): Probing '__android_log_print'.
11-26 13:32:52.242 D/Mono    (17717): Found as '__android_log_print'.
11-26 13:32:52.265 I/MonoDroid(17717): UNHANDLED EXCEPTION:
11-26 13:32:52.335 I/MonoDroid(17717): System.NullReferenceException: Object reference not set to an instance of an object
11-26 13:32:52.343 I/MonoDroid(17717):   at Xamarin.Forms.Platform.Android.AppCompat.Platform.LayoutRootPage (Xamarin.Forms.Page page, Int32 width, Int32 height) [0x00095] in <filename unknown>:0 
11-26 13:32:52.343 I/MonoDroid(17717):   at Xamarin.Forms.Platform.Android.AppCompat.Platform.Xamarin.Forms.Platform.Android.IPlatformLayout.OnLayout (Boolean changed, Int32 l, Int32 t, Int32 r, Int32 b) [0x0000a] in <filename unknown>:0 
11-26 13:32:52.343 I/MonoDroid(17717):   at Xamarin.Forms.Platform.Android.PlatformRenderer.OnLayout (Boolean changed, Int32 l, Int32 t, Int32 r, Int32 b) [0x0000e] in <filename unknown>:0 
11-26 13:32:52.343 I/MonoDroid(17717):   at Android.Views.ViewGroup.n_OnLayout_ZIIII (IntPtr jnienv, IntPtr native__this, Boolean changed, Int32 l, Int32 t, Int32 r, Int32 b) [0x00009] in /Users/builder/data/lanes/2098/3efa14c4/source/monodroid/src/Mono.Android/platforms/android-23/src/generated/Android.Views.ViewGroup.cs:4044 
11-26 13:32:52.343 I/MonoDroid(17717):   at (wrapper dynamic-method) System.Object:c6a7c379-bfe5-4b3c-9a8e-18836b4e4e1d (intptr,intptr,bool,int,int,int,int)
11-26 13:32:52.359 I/dalvikvm(17717): Could not find method java.lang.Throwable.<init>, referenced from method md52ce486a14f4bcd95899665e9d932190b.JavaProxyThrowable.<init>
11-26 13:32:52.359 W/dalvikvm(17717): VFY: unable to resolve direct method 17749: Ljava/lang/Throwable;.<init> (Ljava/lang/String;Ljava/lang/Throwable;ZZ)V
11-26 13:32:52.359 D/dalvikvm(17717): VFY: replacing opcode 0x70 at 0x0000
An unhandled exception occured.

11-26 13:32:53.710 E/mono    (17717): 
11-26 13:32:53.710 E/mono    (17717): Unhandled Exception:
11-26 13:32:53.710 E/mono    (17717): System.NullReferenceException: Object reference not set to an instance of an object
11-26 13:32:53.710 E/mono    (17717):   at (wrapper dynamic-method) System.Object:c6a7c379-bfe5-4b3c-9a8e-18836b4e4e1d (intptr,intptr,bool,int,int,int,int)
11-26 13:32:53.710 E/mono    (17717):   at (wrapper native-to-managed) System.Object:c6a7c379-bfe5-4b3c-9a8e-18836b4e4e1d (intptr,intptr,int,int,int,int,int)
11-26 13:32:53.710 E/mono-rt (17717): [ERROR] FATAL UNHANDLED EXCEPTION: System.NullReferenceException: Object reference not set to an instance of an object
11-26 13:32:53.710 E/mono-rt (17717):   at (wrapper dynamic-method) System.Object:c6a7c379-bfe5-4b3c-9a8e-18836b4e4e1d (intptr,intptr,bool,int,int,int,int)
11-26 13:32:53.710 E/mono-rt (17717):   at (wrapper native-to-managed) System.Object:c6a7c379-bfe5-4b3c-9a8e-18836b4e4e1d (intptr,intptr,int,int,int,int,int)


///Environment
=== Xamarin Studio ===

Version 5.10 (build 871)
Installation UUID: 377bd14f-3531-45ab-ba3f-7c1970039f93
Runtime:
	Microsoft .NET 4.0.30319.42000
	GTK+ 2.24.23 (MS-Windows theme)
	GTK# 2.12.30

=== Xamarin.Profiler ===

Version: 0.20.0.0
Location: C:\Program Files (x86)\Xamarin\Profiler\XamarinProfiler.exe

=== Xamarin.Android ===

Version: 6.0.0 (Business Edition)
Android SDK: C:\android-sdk
	Supported Android versions:
		2.3    (API level 10)
		4.0.3  (API level 15)
		4.1    (API level 16)
		4.2    (API level 17)
		4.3    (API level 18)
		4.4    (API level 19)
		4.4.87 (API level 20)
		5.0    (API level 21)
		5.1    (API level 22)
		6.0    (API level 23)

SDK Tools Version: 24.4.0
SDK Platform Tools Version: 23.0.1

SDK Build Tools Version: 23.0.1


Java SDK: C:\Program Files (x86)\Java\jdk1.7.0_55
java version "1.7.0_55"
Java(TM) SE Runtime Environment (build 1.7.0_55-b13)
Java HotSpot(TM) Client VM (build 24.55-b03, mixed mode, sharing)

=== Xamarin Android Player ===

Version: 0.6.5
Location: C:\Program Files\Xamarin Android Player\DeviceManager.exe

=== Xamarin Inspector ===

Version: 0.3.2.3
Hash: 1b526e6
Branch: master
Build date: Tue Nov 17 20:54:41 UTC 2015

=== Build Information ===

Release ID: 510000871
Git revision: 4e9c5abb5ffdae12ba02ac49da83f8b2011dbb88
Build date: 2015-11-12 07:16:34-05
Xamarin addins: 55007ed0e56436f385d8e26394a45be563abc7e8
Build lane: monodevelop-windows-cycle6

=== Operating System ===

Windows 6.1.7601.65536 (64-bit)

=== Visual Studio ===

Operating System
Windows 6.1.7601.65536 (64-bit)

Microsoft Visual Studio Professional 2015
Version 14.0.23107.0 D14REL
Microsoft .NET Framework
Version 4.6.00081

Installed Version: Professional

Xamarin   4.0.0.1689 (f860fe4)
Visual Studio extension to enable development for Xamarin.iOS and
Xamarin.Android.

Xamarin Inspector Support   0.3.2.3 (1b526e6)
Adds support for inspecting Xamarin and WPF apps.

Xamarin.Android   6.0.0.34 (3efa14c)
Visual Studio plugin to enable development for Xamarin.Android.

Xamarin.iOS   9.2.1.51 (3c0ec35)
Visual Studio extension to enable development for Xamarin.iOS.
Comment 1 Ahmed Alejo 2015-12-06 14:13:36 UTC
I was setting Application.MainPage on OnStart(this worked with FormsApplication Activity);
When i set Application.MainPage from constructor( a loading indicating ContentPage), and then setting my page on OnStart worked without errors.
Comment 2 Gary 2016-10-19 17:18:07 UTC
For us, the crash occurred during setting of the mailpage also. But the root cause was due to the app navigating to another page while the Android 6.0 permissions dialog was shown.
Comment 3 Gary Mc 2016-10-25 00:20:49 UTC
I don't know why this bug is "RESOLVED INVALID" - its still seems to be an issue.

It happened to me, and Ahmed's comment led to the solution. I now set the MainPage in the App constructor like this : 
MainPage = new Page() { BackgroundColor = Color.FromHex("#56B346") };
and then I set it again in OnStart to the page I really want.
Comment 4 Ahmed Alejo 2016-10-26 00:49:16 UTC
I´m reopening this because i gave an explanation for opening it, so i expect one befor it´s closed
Comment 5 Samantha Houts [MSFT] 2016-10-26 23:49:31 UTC
Apologies. I misunderstood Comment 1 to mean that the problem was resolved.
Comment 6 ifloop 2016-12-13 10:01:10 UTC
I'm experiencing the same behavior (crashing) after updating from xamarin forms 2.3.3.175 to the new version 2.3.4.171-pre1 with FormsAppCompatActivity. 

Ahmed's workaround setting MainPage in constructor and OnStart works, but my App is crashing later when setting MainPage to a MasterDetailPage.
Comment 7 Samantha Houts [MSFT] 2016-12-21 01:10:43 UTC
Created attachment 18955 [details]
Test Project

I have attached a new app (File > New Project) updated to the latest Xamarin.Forms stable release. I have moved the code that sets the MainPage to the OnStart override, and I have changed the default page to be a MasterDetailPage.

The app does not crash on startup for me. I am unable to reproduce the error described.

Please take a look at the test project and compare it to your project. If you can, please add to it until you can reproduce the crash and reattach the project here. 

Warm regards,
Xamarin Forms Team
Comment 8 Stef 2017-01-16 17:27:04 UTC
Hi Forms Team!

Are you sure you are using FormsAppCompatActivity in your testing app? I spent the last weeks trying to fix my android app. Finally I could solve it by going back to FormsApplicationActivity, abandoning my splash screen. But at least (for now) I can continue. 

Best regards,
Stefan
Comment 9 RockStar 2017-03-08 18:35:51 UTC
This is really the bug. Any news?
Comment 10 David Ortinau [MSFT] 2017-06-17 01:47:27 UTC
I'm unable to reproduce this problem. If it's occurring for you, please reopen the issue with a project that reproduces the crash.
Comment 11 Sylvain Gravel 2017-10-24 19:16:32 UTC
I'm having this issue with the following Xaml segment.  If I remove the OnPlatform Image.Source, everything works fine.  It also works fine on iOS :

```
<Image AbsoluteLayout.LayoutBounds="0, 0, 1, 1"
       AbsoluteLayout.LayoutFlags="All"
       Aspect="AspectFill">
   <Image.Source>
       <OnPlatform x:TypeArguments="ImageSource">
           <On Platform="iOS">
               <OnIdiom x:TypeArguments="ImageSource"
                        Phone="Default-736h.png"
                        Tablet="Default-iPadPro-Landscape.png" />
           </On>
           <On Platform="Android">
               <OnIdiom x:TypeArguments="ImageSource"
                        Phone="splash_portrait.png"
                        Tablet="splash_landscape.png" />
           </On>
        </OnPlatform>
    </Image.Source>
</Image>
```

If I only put the OnIdiom, everything also works :
```
<Image.Source>
    <OnIdiom x:TypeArguments="ImageSource"
             Phone="splash_portrait.png"
             Tablet="splash_landscape.png" />
</Image.Source>
```

So basically, this leaves this element as problematic : `<On Platform="Android">`

If I try to set the Source in code, it also crashes, even before hitting the   call to `InitializeComponent`:

```
<Image x:Name="LoadingImage"
       AbsoluteLayout.LayoutBounds="0, 0, 1, 1"
       AbsoluteLayout.LayoutFlags="All"
       Aspect="AspectFill">
```
```
using AppliOrange.Views.Interfaces;
using Xamarin.Forms;

namespace AppliOrange.Views
{
    public partial class LoadingPage
    {
        public LoadingPage()
        {
            InitializeComponent();

            switch (Device.RuntimePlatform)
            {
                case Device.iOS:
                {
                    LoadingImage.Source = Device.Idiom == TargetIdiom.Phone ?
                                              "Default-736h.png" :
                                              "Default-iPadPro-Landscape.png";
                    break;
                }
                case Device.Android:
                {
                    LoadingImage.Source = Device.Idiom == TargetIdiom.Phone ?
                                              "splash_portrait.png" :
                                              "splash_landscape.png";
                    break;
                }
            }
        }
    }
}
```

What if I only try to look up the platform... it also fails :
```
if (Device.RuntimePlatform == Device.Android)
{
    int i = 0;
}
```

So basically, referring to `Device.RuntimePlatform`causes the crash.
Comment 12 Chase Long 2017-12-19 23:40:12 UTC
My app also crashes every time on Android when switching to FormsAppCompatActivity. I followed the instructions at https://developer.xamarin.com/guides/xamarin-forms/platform-features/android/appcompat/, except I left out the toolbar and tabbar because I use custom equivalents implemented with Xamarin.Forms views.

12-19 17:28:36.097 I/MonoDroid( 3545): UNHANDLED EXCEPTION:
12-19 17:28:36.169 I/MonoDroid( 3545): System.NullReferenceException: Object reference not set to an instance of an object.
12-19 17:28:36.169 I/MonoDroid( 3545):   at Xamarin.Forms.Platform.Android.FormsAppCompatActivity.InternalSetPage (Xamarin.Forms.Page page) [0x0005e] in D:\agent\_work\2\s\Xamarin.Forms.Platform.Android\AppCompat\FormsAppCompatActivity.cs:315 
12-19 17:28:36.169 I/MonoDroid( 3545):   at Xamarin.Forms.Platform.Android.FormsAppCompatActivity.SetMainPage () [0x00000] in D:\agent\_work\2\s\Xamarin.Forms.Platform.Android\AppCompat\FormsAppCompatActivity.cs:343 
12-19 17:28:36.169 I/MonoDroid( 3545):   at Xamarin.Forms.Platform.Android.FormsAppCompatActivity.LoadApplication (Xamarin.Forms.Application application) [0x0025c] in D:\agent\_work\2\s\Xamarin.Forms.Platform.Android\AppCompat\FormsAppCompatActivity.cs:139 
12-19 17:28:36.169 I/MonoDroid( 3545):   at MyApp.Client.Mobile.Android.MainActivity.Bootstrap () [0x00013] in C:\Users\Chase\MyApp\MyAppWeb\projects\MyApp.Client.Mobile.Android\MainActivity.cs:165 
12-19 17:28:36.169 I/MonoDroid( 3545):   at MyApp.Client.Mobile.Android.MainActivity.OnCreate (Android.OS.Bundle bundle) [0x00128] in C:\Users\Chase\MyApp\MyAppWeb\projects\MyApp.Client.Mobile.Android\MainActivity.cs:130 
12-19 17:28:36.169 I/MonoDroid( 3545):   at Android.App.Activity.n_OnCreate_Landroid_os_Bundle_ (System.IntPtr jnienv, System.IntPtr native__this, System.IntPtr native_savedInstanceState) [0x0000f] in <28e323a707a2414f8b493f6d4bb27c8d>:0 
12-19 17:28:36.169 I/MonoDroid( 3545):   at (wrapper dynamic-method) System.Object:23ebec11-265b-4e08-a230-758352470869 (intptr,intptr,intptr)

Relevant NuGet packages:
Xamarin.Forms 2.5.0.91635
Xamarin.Android.Support.v4 v26.1.0.1
Xamarin.Android.Support.v7.AppCompat v26.1.0.1

Visual Studio installed products:
Xamarin   4.8.0.753 (6575bd113)
Xamarin.Android SDK   8.1.0.25 (HEAD/d8c6e504f)

Android Manifest:
Target Android Version "Compile using SDK version"
Minimum Android version: Android 5.0 (API Level 21 - Lollipop)
Comment 13 Laurents Meyer 2018-01-24 12:02:42 UTC
I suddenly encountered the same issue and exception using Xamarin.Forms 2.5.0.122203 on Android, after making various changes to my non-startup code, without changing Xamarin library versions.

FIX:
The exception is not thrown anymore after I made sure, that Application.MainPage is set to a valid page (not null) before calling LoadApplication:

Forms.Init(context, Bundle.Empty);
myApp.MainPage = myMainPage;
LoadApplication(myApp);
Comment 14 Nick Peppers 2018-03-09 04:37:20 UTC
I'm seeing a similar issue. 

UNHANDLED EXCEPTION:
[MonoDroid] System.NullReferenceException: Object reference not set to an instance of an object
[MonoDroid]   at Xamarin.Forms.Platform.Android.FormsAppCompatActivity.InternalSetPage (Xamarin.Forms.Page page) [0x0006f] in <173f39d71f0d4d928f5bbea42e96ffa8>:0 
[MonoDroid]   at Xamarin.Forms.Platform.Android.FormsAppCompatActivity.SetMainPage () [0x0000c] in <173f39d71f0d4d928f5bbea42e96ffa8>:0 
[MonoDroid]   at Xamarin.Forms.Platform.Android.FormsAppCompatActivity.LoadApplication (Xamarin.Forms.Application application) [0x0025c] in <173f39d71f0d4d928f5bbea42e96ffa8>:0 
[MonoDroid]   at Operatives.Forms.Droid.MainActivity.OnCreate (Android.OS.Bundle savedInstanceState) [0x00070] in <6eb39c0b84894c499c76cc4b04fdb230>:0 
[MonoDroid]   at Android.App.Activity.n_OnCreate_Landroid_os_Bundle_ (System.IntPtr jnienv, System.IntPtr native__this, System.IntPtr native_savedInstanceState) [0x0000f] in <e2964741c0aa47b6a0b67046aeb3360d>:0 
[MonoDroid]   at (wrapper dynamic-method) System.Object.fd98c73e-4b79-44d5-b58f-ad7e6b2caa1e(intptr,intptr,intptr)
[art] JNI RegisterNativeMethods: attempt to register 0 native methods for android.runtime.JavaProxyThrowable
[AndroidRuntime] Shutting down VM
[AndroidRuntime] FATAL EXCEPTION: main
[AndroidRuntime] Process: com.nickpeppers.operatives, PID: 13939
[AndroidRuntime] android.runtime.JavaProxyThrowable: System.NullReferenceException: Object reference not set to an instance of an object
[AndroidRuntime]   at Xamarin.Forms.Platform.Android.FormsAppCompatActivity.InternalSetPage (Xamarin.Forms.Page page) [0x0006f] in <173f39d71f0d4d928f5bbea42e96ffa8>:0 
[AndroidRuntime]   at Xamarin.Forms.Platform.Android.FormsAppCompatActivity.SetMainPage () [0x0000c] in <173f39d71f0d4d928f5bbea42e96ffa8>:0 
[AndroidRuntime]   at Xamarin.Forms.Platform.Android.FormsAppCompatActivity.LoadApplication (Xamarin.Forms.Application application) [0x0025c] in <173f39d71f0d4d928f5bbea42e96ffa8>:0 
[AndroidRuntime]   at Operatives.Forms.Droid.MainActivity.OnCreate (Android.OS.Bundle savedInstanceState) [0x00070] in <6eb39c0b84894c499c76cc4b04fdb230>:0 
[AndroidRuntime]   at Android.App.Activity.n_OnCreate_Landroid_os_Bundle_ (System.IntPtr jnienv, System.IntPtr native__this, System.IntPtr native_savedInstanceState) [0x0000f] in <e2964741c0aa47b6a0b67046aeb3360d>:0 
[AndroidRuntime]   at (wrapper dynamic-method) System.Object.fd98c73e-4b79-44d5-b58f-ad7e6b2caa1e(intptr,intptr,intptr)
[AndroidRuntime] 	at md530949bbaf44ecf314f18a58ea7478a5f.MainActivity.n_onCreate(Native Method)
[AndroidRuntime] 	at md530949bbaf44ecf314f18a58ea7478a5f.MainActivity.onCreate(MainActivity.java:30)
[AndroidRuntime] 	at android.app.Activity.performCreate(Activity.java:6720)
[AndroidRuntime] 	at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1119)
[AndroidRuntime] 	at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2632)
[AndroidRuntime] 	at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2740)
[AndroidRuntime] 	at android.app.ActivityThread.-wrap12(ActivityThread.java)
[AndroidRuntime] 	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1487)
[AndroidRuntime] 	at android.os.Handler.dispatchMessage(Handler.java:102)
[AndroidRuntime] 	at android.os.Looper.loop(Looper.java:154)
[AndroidRuntime] 	at android.app.ActivityThread.main(ActivityThread.java:6171)
[AndroidRuntime] 	at java.lang.reflect.Method.invoke(Native Method)
[AndroidRuntime] 	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:888)
[AndroidRuntime] 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:778)

I'm using the latest stable VS, Xamarin.Forms 2.5.0.280555 and the latest Android support libraries 27.02 built with target SDk 27. The only workaround I found that worked was to switch from FormsAppCompatActivity to FormsApplicationActivity, which isn't ideal.
Comment 15 Nick Peppers 2018-03-09 23:55:45 UTC
This only happened in release mode when using FormsAppCompatActivity. The workaround I found for now was to turn Proguard off instead of going back to FormsApplicationActivity.
Comment 16 Stanislav Iegorov 2018-03-14 09:03:20 UTC
Same happened to me with exactly same exceptions. 
How did I solve it? I noticed that before this problem arose I updated Android support libs to the latest version. So I just reverted all of them back and everything is fine.
I don't need to bother with workarounds for not properly tested Google libs. 
As long as they are fixed just update and proceed.
Comment 17 Artem T 2018-03-16 09:10:12 UTC
I'm also having this problem. How do you revert these "Android support libs"? Are you talking about the Nuget packages in my Xamarin.Android manager? Which version do you use? 
Or is it "Android Support Repository" in Android SDK Manager? I'm using rev.41, but rev.47 also gives the same problem.
Comment 18 Nick Peppers 2018-03-16 12:44:31 UTC
He's referring to the nuget packages which I did only run into this issue after upgrading from 26.1.0.1 to the 27.0.2 versions so reverting back to the 26 versions may resolve your issues.
Comment 19 Stanislav Iegorov 2018-03-16 14:24:39 UTC
Nick is correct, Artem. I was referring to the NuGet packages, but forgot to mention correct version which is 26.1.0.1