我正在使用内部Webview开发Xamarin.Forms应用程序。在我的这个Android设备中,发生了一些崩溃,这些崩溃显示在Google Play控制台中。有人可以帮我吗?
错误消息
android.runtime.JavaProxyThrowable: at Xamarin.Forms.Device.get_PlatformServices () [0x00007] in <68ab566bdacc435a8adf7cece6abb272>:0
at Xamarin.Forms.Device.GetAssemblies () [0x00000] in <68ab566bdacc435a8adf7cece6abb272>:0
at Xamarin.Forms.DependencyService.Initialize () [0x00008] in <68ab566bdacc435a8adf7cece6abb272>:0
at Xamarin.Forms.DependencyService.Get[T] (Xamarin.Forms.DependencyFetchTarget fetchTarget) [0x00000] in <68ab566bdacc435a8adf7cece6abb272>:0
at Xamarin.Forms.Application..ctor () [0x0002b] in <68ab566bdacc435a8adf7cece6abb272>:0
at MeinEWE.App..ctor () [0x00000] in <7b249c0b0e004be3aa733910ee8dffd8>:0
at MeinEWE.Droid.StartActivity.OnCreate (Android.OS.Bundle savedInstanceState) [0x00007] in <018fe477438642d88af72a93fcfa16c1>:0
at Android.App.Activity.n_OnCreate_Landroid_os_Bundle_ (System.IntPtr jnienv, System.IntPtr native__this, System.IntPtr native_savedInstanceState) [0x00011] in <2b67a0b2f42248818afbd77843dff211>:0
at (wrapper dynamic-method) Android.Runtime.DynamicMethodNameCounter.7(intptr,intptr,intptr)
at md5725ec680625e4d82d39e64f30f8fe933.StartActivity.n_onCreate (Native Method)
at md5725ec680625e4d82d39e64f30f8fe933.StartActivity.onCreate (StartActivity.java:29)
at android.app.Activity.performCreate (Activity.java:7327)
at android.app.Activity.performCreate (Activity.java:7318)
at android.app.Instrumentation.callActivityOnCreate (Instrumentation.java:1275)
at android.app.ActivityThread.performLaunchActivity (ActivityThread.java:3101)
at android.app.ActivityThread.handleLaunchActivity (ActivityThread.java:3264)
at android.app.servertransaction.LaunchActivityItem.execute (LaunchActivityItem.java:78)
at android.app.servertransaction.TransactionExecutor.executeCallbacks (TransactionExecutor.java:108)
at android.app.servertransaction.TransactionExecutor.execute (TransactionExecutor.java:68)
at android.app.ActivityThread$H.handleMessage (ActivityThread.java:1955)
at android.os.Handler.dispatchMessage (Handler.java:106)
at android.os.Looper.loop (Looper.java:214)
at android.app.ActivityThread.main (ActivityThread.java:7076)
at java.lang.reflect.Method.invoke (Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:965)
我认为该错误发生在OnCreate方法内部,但我不知道如何解决:
MainActivity.cs
protected override void OnCreate(Bundle savedInstanceState)
{
TabLayoutResource = Resource.Layout.Tabbar;
ToolbarResource = Resource.Layout.Toolbar;
FormsWebViewRenderer.Initialize();
base.OnCreate(savedInstanceState);
global::Xamarin.Forms.Forms.Init(this, savedInstanceState);
AnimationViewRenderer.Init();
RequestedOrientation = !IsTablet ? ScreenOrientation.SensorPortrait : ScreenOrientation.SensorLandscape;
Android.Webkit.WebView.SetWebContentsDebuggingEnabled(true);
StartActivity(typeof(StartActivity));
}
StartActivity.cs
protected override void OnCreate(Bundle savedInstanceState)
{
base.OnCreate(savedInstanceState);
LoadApplication(new App());
RequestedOrientation = !IsTablet ? ScreenOrientation.SensorPortrait : ScreenOrientation.SensorLandscape;
}