CrossGeeks / ClearableDatePickerSample

Clearable DatePicker Sample in Xamarin Forms
MIT License
19 stars 11 forks source link

App crashes with NullReferenceException, when setting MainPage #13

Open wegascee opened 6 years ago

wegascee commented 6 years ago

Can't get this project working. It crashes on app start with "Object reference not set to an instance of an object". Seems the custom renderer is doing something wrong on a more up to date environment (XF 2.5.1.527436, Android 6 simulator).

I think this is the related log:

Time Device Name Type PID Tag Message 09-18 11:26:29.089 10.1" Marshmallow (6.0.0) XHDPI Tablet Info 2367 MonoDroid System.NullReferenceException: Object reference not set to an instance of an object. at Xamarin.Forms.Platform.Android.FormsAppCompatActivity.InternalSetPage (Xamarin.Forms.Page page) [0x0005e] in D:\agent_work\1\s\Xamarin.Forms.Platform.Android\AppCompat\FormsAppCompatActivity.cs:315 at Xamarin.Forms.Platform.Android.FormsAppCompatActivity.SetMainPage () [0x00000] in D:\agent_work\1\s\Xamarin.Forms.Platform.Android\AppCompat\FormsAppCompatActivity.cs:343 at Xamarin.Forms.Platform.Android.FormsAppCompatActivity.LoadApplication (Xamarin.Forms.Application application) [0x0025c] in D:\agent_work\1\s\Xamarin.Forms.Platform.Android\AppCompat\FormsAppCompatActivity.cs:139 at NullableDatePicker.Droid.MainActivity.OnCreate (Android.OS.Bundle bundle) [0x00027] in C:\Projects\ClearableDatePickerSample-master\Droid\MainActivity.cs:25 at Android.App.Activity.n_OnCreate_Landroid_osBundle (System.IntPtr jnienv, System.IntPtr native__this, System.IntPtr native_savedInstanceState) [0x0000f] in :0 at (wrapper dynamic-method) System.Object.10eeeb63-65e6-4ea1-ae3f-d502cc9d1404(intptr,intptr,intptr)

Seems that the style cannot be applied.

Now I changed the target framework to Android 6.0 and now it starts! (from Android 8)

Perhaps the VS 2015 is the reason for the cause. Here I have Android SDK Tools 25.2.5 installed, but newer version are not compatible. If someone runs in the same issue, he can lower the target framework.