我刚刚为Mac安装了最新版本的Visual Studio Community 2019。我正在尝试开发wearOS应用。在XML编辑器中选择Wear OS Round 390x390作为设备时,尝试在设计模式下查看activity_main.xml
时,我收到以下错误。任何想法为什么以及如何解决这个问题?
错误:
System.InvalidOperationException: Resource not found: wear-frame-round-390.png
at Xwt.Backends.ImageBackendHandler.LoadFromResource (System.Reflection.Assembly asm, System.String name) [0x0000b] in /Users/runner/runners/2.164.7/work/1/s/main/external/xwt/Xwt/Xwt.Backends/ImageBackendHandler.cs:46
at Xwt.Drawing.ResourceImageLoader.LoadImage (System.String fileName) [0x00000] in /Users/runner/runners/2.164.7/work/1/s/main/external/xwt/Xwt/Xwt.Drawing/Image.cs:1051
at Xwt.Drawing.Image.LoadImage (Xwt.Drawing.ImageLoader loader, System.String fileName, Xwt.Drawing.ImageTagSet tagFilter) [0x0000f] in /Users/runner/runners/2.164.7/work/1/s/main/external/xwt/Xwt/Xwt.Drawing/Image.cs:198
at Xwt.Drawing.Image.FromResource (System.Reflection.Assembly assembly, System.String resource, Xwt.Drawing.ImageTagSet tagFilter) [0x00039] in /Users/runner/runners/2.164.7/work/1/s/main/external/xwt/Xwt/Xwt.Drawing/Image.cs:189
at Xwt.Drawing.Image.FromResource (System.Reflection.Assembly assembly, System.String resource) [0x00000] in /Users/runner/runners/2.164.7/work/1/s/main/external/xwt/Xwt/Xwt.Drawing/Image.cs:174
at Xwt.Drawing.Image.FromResource (System.Type type, System.String resource) [0x00022] in /Users/runner/runners/2.164.7/work/1/s/main/external/xwt/Xwt/Xwt.Drawing/Image.cs:157
at Xamarin.AndroidDesigner.Styles.GetWearBack (System.String resName) [0x00015] in /Users/runner/runners/2.164.3/work/1/s/Xamarin.Designer.Android/Xamarin.AndroidDesigner/Styles.cs:417
at Xamarin.AndroidDesigner.Styles.GetWearRoundBack (System.Int32 dimen, System.Int32 chinHeight) [0x00035] in /Users/runner/runners/2.164.3/work/1/s/Xamarin.Designer.Android/Xamarin.AndroidDesigner/Styles.cs:404
at Xamarin.AndroidDesigner.Mac.MacAndroidSurfaceRenderer.SetupWearBack (CoreAnimation.CALayer itemLayer) [0x000d5] in /Users/runner/runners/2.164.3/work/1/s/Xamarin.Designer.Android/Xamarin.AndroidDesigner.Mac/MacAndroidSurfaceRenderer.cs:146
at Xamarin.AndroidDesigner.Mac.MacAndroidSurfaceRenderer.RenderDesignerItemLayer (Xamarin.Designer.DesignerItem item) [0x0026f] in /Users/runner/runners/2.164.3/work/1/s/Xamarin.Designer.Android/Xamarin.AndroidDesigner.Mac/MacAndroidSurfaceRenderer.cs:98
at Xamarin.Designer.Mac.CALayerSurfaceRenderer.QueueRender (Xamarin.Designer.DesignerItem designerItem) [0x0002c] in /Users/runner/runners/2.164.3/work/1/s/Xamarin.Designer/Xamarin.Designer.Mac/CALayerSurfaceRenderer.cs:588
at Xamarin.AndroidDesigner.AndroidDesignerSurface.HandleSessionImageChanged (System.Object sender, System.EventArgs e) [0x0014c] in /Users/runner/runners/2.164.3/work/1/s/Xamarin.Designer.Android/Xamarin.AndroidDesigner/AndroidDesignerSurface.cs:257
at (wrapper delegate-invoke) <Module>.invoke_void_object_EventArgs(object,System.EventArgs)
at Xamarin.AndroidDesigner.AndroidDesignerSession.OnImageChanged () [0x00008] in /Users/runner/runners/2.164.3/work/1/s/Xamarin.Designer.Android/Xamarin.AndroidDesigner/AndroidDesignerSession.cs:1568
at Xamarin.AndroidDesigner.AndroidDesignerSession.HandleRendered (System.Object sender, System.EventArgs e) [0x0011a] in /Users/runner/runners/2.164.3/work/1/s/Xamarin.Designer.Android/Xamarin.AndroidDesigner/AndroidDesignerSession.cs:1404
我的解决方案中的我的资源文件夹:
我的activity.xml
:
<?xml version="1.0" encoding="utf-8"?>
<android.support.wear.widget.BoxInsetLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:padding="@dimen/box_inset_layout_padding" tools:deviceIds="wear">
<FrameLayout android:layout_width="match_parent" android:layout_height="match_parent" android:padding="@dimen/inner_frame_layout_padding" app:boxedEdges="all">
<TextView android:id="@+id/text" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/hello_world" />
</FrameLayout>
</android.support.wear.widget.BoxInsetLayout>
VS屏幕截图: