我開始在Android上使用Xamarin Forms構建UI。我的XAML
文件在下面給出。不幸的是,MyApp.Android已經停止。與ContentPage.Resource在XAML文件中
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:PortableViews="clr-namespace:MyApp.Portable.Views"
x:Class="MyApp.Portable.Views.MainPage3">
<ContentPage.Resources>
<PortableViews:NullVisibilityConverter x:Key="NullVisibilityConverter"/>
</ContentPage.Resources>
<Grid>
</Grid>
</ContentPage>
我能夠編譯和部署到device.When我運行與設備的應用程序,我得到的錯誤說 Unfortunately, MyApp.Android has stopped.
如果我註釋掉<ContentPage.Resources>
標籤它運行並顯示我一個空白屏幕。爲什麼不對
<ContentPage.Resources>
<PortableViews:NullVisibilityConverter x:Key="NullVisibilityConverter"/>
</ContentPage.Resources>
logcat顯示以下消息。
11-10 14:01:39.675 I/DEBUG (2131): [OnPurpose Redunant in void preset_info(aed_report_record*, int, int)] pid: 2058, tid: -1361051648, name: UNKNOWN >>> MyApp.Android.MyApp.Android
如果我的logcat看Android Runtime
我收到以下錯誤。
11-10 14:42:18.554 E/AndroidRuntime(4487): FATAL EXCEPTION: main
11-10 14:42:18.554 E/AndroidRuntime(4487): Process: MyApp.Android.MyApp.Android, PID: 4487
11-10 14:42:18.554 E/AndroidRuntime(4487): java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
11-10 14:42:18.554 E/AndroidRuntime(4487): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:750)
11-10 14:42:18.554 E/AndroidRuntime(4487): Caused by: java.lang.reflect.InvocationTargetException
11-10 14:42:18.554 E/AndroidRuntime(4487): at java.lang.reflect.Method.invoke(Native Method)
11-10 14:42:18.554 E/AndroidRuntime(4487): at java.lang.reflect.Method.invoke(Method.java:372)
11-10 14:42:18.554 E/AndroidRuntime(4487): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:955)
11-10 14:42:18.554 E/AndroidRuntime(4487): ... 1 more
11-10 14:42:18.554 E/AndroidRuntime(4487): Caused by: android.runtime.JavaProxyThrowable: Xamarin.Forms.Xaml.XamlParseException: Position 13:6. Type Window not found in xmlns http://xamarin.com/schemas/2014/forms
11-10 14:42:18.554 E/AndroidRuntime(4487): at Xamarin.Forms.Xaml.ApplyPropertiesVisitor.GetRealNameAndType (System.Type& elementType, System.String namespaceURI, System.String& localname, Xamarin.Forms.Xaml.HydratationContext context, IXmlLineInfo lineInfo) <0x7f59f99ac0 + 0x0013c> in <filename unknown>:0
11-10 14:42:18.554 E/AndroidRuntime(4487): at Xamarin.Forms.Xaml.ApplyPropertiesVisitor.SetPropertyValue (System.Object xamlelement, XmlName propertyName, System.Object value, Xamarin.Forms.BindableObject rootElement, INode node, Xamarin.Forms.Xaml.HydratationContext context, IXmlLineInfo lineInfo) <0x7f59fb3160 + 0x0013b> in <filename unknown>:0
11-10 14:42:18.554 E/AndroidRuntime(4487): at Xamarin.Forms.Xaml.ApplyPropertiesVisitor.Visit (Xamarin.Forms.Xaml.ElementNode node, INode parentNode) <0x7f59f9e048 + 0x005eb> in <filename unknown>:0
11-10 14:42:18.554 E/AndroidRuntime(4487): at Xamarin.Forms.Xaml.ElementNode.Accept (IXamlNodeVisitor visitor, INode parentNode) <0x7f59fc4658 + 0x00277> in <filename unknown>:0
11-10 14:42:18.554 E/AndroidRuntime(4487): at Xamarin.Forms.Xaml.RootNode.Accept (IXamlNodeVisitor visitor, INode parentNode) <0x7f59fc3ed8 + 0x000ff> in <filename unknown>:0
11-10 14:42:18.554 E/AndroidRuntime(4487): at Xamarin.Forms.Xaml.XamlLoader.Load (Xamarin.Forms.BindableObject view, System.String xaml) <0x7f5a924650 + 0x00387> in <filename unknown>:0
11-10 14:42:18.554 E/AndroidRuntime(4487): at Xamarin.Forms.Xaml.XamlLoader.Load (Xamarin.Forms.BindableObject view, System.Type callingType) <0x7f5a99ba20 + 0x00053> in <filename unknown>:0
11-10 14:42:18.554 E/AndroidRuntime(4487): at Xamarin.Forms.Xaml.Extensions.LoadFromXaml[TView] (Xamarin.Forms.Xaml.TView view, System.Type callingType) <0x7f5a99b9d8 + 0x00023> in <filename unknown>:0
11-10 14:42:18.554 E/AndroidRuntime(4487): at MyApp.Portable.Views.MainPage3.InitializeComponent() <0x7f5a99b950 + 0x0002b> in <filename unknown>:0
11-10 14:42:18.554 E/AndroidRuntime(4487): at MyApp.Portable.Views.MainPage3..ctor() <0x7f5a9bf0d0 + 0x0001f> in <filename unknown>:0
11-10 14:42:18.554 E/AndroidRuntime(4487): at MyApp.Portable.App..ctor() <0x7f5b4276f8 + 0x0002f> in <filename unknown>:0
11-10 14:42:18.554 E/AndroidRuntime(4487): at MyApp.Android.MainActivity.OnCreate (Android.OS.Bundle bundle) <0x7f5b457370 + 0x00043> in <filename unknown>:0
11-10 14:42:18.554 E/AndroidRuntime(4487): at Android.App.Activity.n_OnCreate_Landroid_os_Bundle_ (IntPtr jnienv, IntPtr native__this, IntPtr native_savedInstanceState) <0x7f5b457080 + 0x00063> in <filename unknown>:0
11-10 14:42:18.554 E/AndroidRuntime(4487): at (wrapper dynamic-method) System.Object:5c4437ec-ddbf-41de-b890-3c31365af092 (intptr,intptr,intptr)
11-10 14:42:18.554 E/AndroidRuntime(4487): at md5b10bea1896ca4a98de5581931a9e1765.MainActivity.n_onCreate(Native Method)
11-10 14:42:18.554 E/AndroidRuntime(4487): at md5b10bea1896ca4a98de5581931a9e1765.MainActivity.onCreate(MainActivity.java:29)
11-10 14:42:18.554 E/AndroidRuntime(4487): at android.app.Activity.performCreate(Activity.java:5971)
11-10 14:42:18.554 E/AndroidRuntime(4487): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1111)
11-10 14:42:18.554 E/AndroidRuntime(4487): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2413)
11-10 14:42:18.554 E/AndroidRuntime(4487): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2522)
11-10 14:42:18.554 E/AndroidRuntime(4487): at android.app.ActivityThread.access$800(ActivityThread.java:167)
11-10 14:42:18.554 E/AndroidRuntime(4487): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1417)
11-10 14:42:18.554 E/AndroidRuntime(4487): at android.os.Handler.dispatchMessage(Handler.java:111)
11-10 14:42:18.554 E/AndroidRuntime(4487): at android.os.Looper.loop(Looper.java:194)
11-10 14:42:18.554 E/AndroidRuntime(4487): at android.app.ActivityThread.main(ActivityThread.java:5534)
11-10 14:42:18.554 E/AndroidRuntime(4487): ... 4 more
logcat中顯示以下信息。 '11-10 14:01:39.675 I/DEBUG(2131):[OnPurpose Redunant in void preset_info(aed_report_record *,int,int)] pid:2058,tid:-1361051648,name:UNKNOWN >>> MyApp.Android。 MyApp.Android <<<' – liv2hak
@ cricket_007 - 更新完成 – liv2hak
@ cricket_007 - 我正在使用Filter by:'DEBUG'我應該選擇其他的東西嗎? – liv2hak