Quantcast
Viewing all articles
Browse latest Browse all 89864

LoadApplication exception when Theme is set

I'm trying to add a splash screen to a Forms app (Android & iOS). The app is working as it is but at start up Android shows a gray screen with the logo and app name on top.

I looked at http://developer.xamarin.com/guides/android/user_interface/creating_a_splash_screen/ to find a solution.

So I added a theme in an existing Style.xml

<style name="Theme.Splash" parent="android:Theme">
            <item name="android:windowBackground">@drawable/SearchLogo</item>
            <item name="android:windowNoTitle">true</item>
        </style>

Then I altered my existing MainActivity
[Activity(MainLauncher = true, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation, Theme = "@style/Theme.Splash", NoHistory = true)]
` public class MainActivity : global::Xamarin.Forms.Platform.Android.FormsApplicationActivity
{
protected async override void OnCreate(Bundle bundle)
{
base.OnCreate(bundle);

        Xamarin.Forms.Forms.Init(this, bundle);
        LoadApplication(new App());
    }
}`

In my Forms App.cs I create the Forms pages
public class App : Xamarin.Forms.Application
{
public App()
{
MainPage = new SearchPage();
}
}

But the call to LoadApplication throws a null pointer exception. Can anyone help me figuring this out?
11-18 14:50:30.356 D/dalvikvm(18338): GC_FOR_ALLOC freed 4327K, 22% free 20484K/26119K, paused 12ms, total 12ms
11-18 14:50:30.456 D/Mono (18338): Assembly Ref addref Mono.Android[0x5720ecd8] -> System.Xml[0x59a2d888]: 4
Exception:

System.NullReferenceException: Object reference not set to an instance of an object
Resolved pending breakpoint at 'RunningBroadcastReceiver.cs:41,1' to void CDMForms.Droid.BroadcastReceivers.RunningBroadcastReceiver.OnReceive (Android.Content.Context context, Android.Content.Intent intent) [0x00001].
11-18 14:51:07.041 D/Mono (18338): DllImport attempting to load: '/system/lib/liblog.so'.
11-18 14:51:07.041 D/Mono (18338): DllImport loaded library '/system/lib/liblog.so'.
11-18 14:51:07.041 D/Mono (18338): DllImport searching in: '/system/lib/liblog.so' ('/system/lib/liblog.so').
11-18 14:51:07.041 D/Mono (18338): Searching for '__android_log_print'.
11-18 14:51:07.041 D/Mono (18338): Probing '__android_log_print'.
11-18 14:51:07.041 D/Mono (18338): Found as '__android_log_print'.
11-18 14:51:07.046 I/MonoDroid(18338): UNHANDLED EXCEPTION:
11-18 14:51:07.046 I/MonoDroid(18338): System.NullReferenceException: Object reference not set to an instance of an object
11-18 14:51:07.046 I/MonoDroid(18338): at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000b] in /Users/builder/data/lanes/2185/53fce373/source/mono/mcs/class/corlib/System.Runtime.ExceptionServices/ExceptionDispatchInfo.cs:61
11-18 14:51:07.051 I/MonoDroid(18338): at System.Runtime.CompilerServices.AsyncMethodBuilderCore.m__0 (object) [0x00000] in /Users/builder/data/lanes/2185/53fce373/source/mono/external/referencesource/mscorlib/system/runtime/compilerservices/AsyncMethodBuilder.cs:1006
11-18 14:51:07.051 I/MonoDroid(18338): at Android.App.SyncContext/c__AnonStorey0.<>m__0 () [0x00000] in /Users/builder/data/lanes/2185/53fce373/source/monodroid/src/Mono.Android/src/Android.App/SyncContext.cs:18
11-18 14:51:07.051 I/MonoDroid(18338): at Java.Lang.Thread/RunnableImplementor.Run () [0x0000b] in /Users/builder/data/lanes/2185/53fce373/source/monodroid/src/Mono.Android/src/Java.Lang/Thread.cs:36
11-18 14:51:07.051 I/MonoDroid(18338): at Java.Lang.IRunnableInvoker.n_Run (intptr,intptr) [0x00009] in /Users/builder/data/lanes/2185/53fce373/source/monodroid/src/Mono.Android/platforms/android-19/src/generated/Java.Lang.IRunnable.cs:71
11-18 14:51:07.051 I/MonoDroid(18338): at (wrapper dynamic-method) object.f9eeea9a-e0ee-43f8-9d7c-120709ec0363 (intptr,intptr)
11-18 14:51:07.066 I/dalvikvm(18338): Could not find method java.lang.Throwable., referenced from method md52ce486a14f4bcd95899665e9d932190b.JavaProxyThrowable.
11-18 14:51:07.066 W/dalvikvm(18338): VFY: unable to resolve direct method 8269: Ljava/lang/Throwable;. (Ljava/lang/String;Ljava/lang/Throwable;ZZ)V
11-18 14:51:07.066 D/dalvikvm(18338): VFY: replacing opcode 0x70 at 0x0000
11-18 14:51:07.076 D/AndroidRuntime(18338): Shutting down VM
11-18 14:51:07.076 W/dalvikvm(18338): threadid=1: thread exiting with uncaught exception (group=0x419ed2a0)
An unhandled exception occured.

11-18 14:51:14.591 E/AndroidRuntime(18338): FATAL EXCEPTION: main
11-18 14:51:14.591 E/AndroidRuntime(18338): java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
11-18 14:51:14.591 E/AndroidRuntime(18338): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:794)
11-18 14:51:14.591 E/AndroidRuntime(18338): at dalvik.system.NativeStart.main(Native Method)
11-18 14:51:14.591 E/AndroidRuntime(18338): Caused by: java.lang.reflect.InvocationTargetException
11-18 14:51:14.591 E/AndroidRuntime(18338): at java.lang.reflect.Method.invokeNative(Native Method)
11-18 14:51:14.591 E/AndroidRuntime(18338): at java.lang.reflect.Method.invoke(Method.java:511)
11-18 14:51:14.591 E/AndroidRuntime(18338): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1027)
11-18 14:51:14.591 E/AndroidRuntime(18338): ... 2 more
11-18 14:51:14.591 E/AndroidRuntime(18338): Caused by: md52ce486a14f4bcd95899665e9d932190b.JavaProxyThrowable: System.NullReferenceException: Object reference not set to an instance of an object
11-18 14:51:14.591 E/AndroidRuntime(18338): at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000b] in /Users/builder/data/lanes/2185/53fce373/source/mono/mcs/class/corlib/System.Runtime.ExceptionServices/ExceptionDispatchInfo.cs:61
11-18 14:51:14.591 E/AndroidRuntime(18338): at System.Runtime.CompilerServices.AsyncMethodBuilderCore.m__0 (object) [0x00000] in /Users/builder/data/lanes/2185/53fce373/source/mono/external/referencesource/mscorlib/system/runtime/compilerservices/AsyncMethodBuilder.cs:1006


Viewing all articles
Browse latest Browse all 89864

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>