2

I've just installed the latest version of Visual Studio Community 2019 for Mac. I'm attempting to develop a wearOS app. When selecting Wear OS Round 390x390 as the device in the XML editor, I receive the following error below when attempting to view activity_main.xml in design mode. Any ideas why and how to resolve this?

Error:

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 

My Resources folder in my solution:

enter image description here

My 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 screenshot:

enter image description here

Bhav
  • 1,957
  • 7
  • 33
  • 66
  • Hi , from error log , `wear-frame-round-390.png` can not be found , does it exist in `Resources` folder of project . – Junior Jiang Feb 19 '20 at 01:37
  • @JuniorJiang-MSFT No, I've modified my post to include a screenshot of my Resources folder. It's the default files created in a new wearOS app on Visual Studio for Mac. – Bhav Feb 19 '20 at 07:15
  • OK , do you mean the new created project occurs error when running first time . – Junior Jiang Feb 19 '20 at 08:05
  • No, I'm not attempting to run it. It's the design view when modifying activity_main.axml. – Bhav Feb 19 '20 at 08:24
  • OK , Could you share the screenshot of `activity_main.axml` ? – Junior Jiang Feb 19 '20 at 08:47
  • @JuniorJiang-MSFT I've added it to my OP. – Bhav Feb 19 '20 at 18:46
  • Hi , I have created a new Android Wear project in my local site , `xml` shows no error . I want to know how to select Wear OS Round 390x390 as the device in the XML editor , then I can check that whehter works . The version of VS for Mac is `8.4.6` . – Junior Jiang Feb 20 '20 at 02:01
  • @JuniorJiang-MSFT I've added a screenshot. You should see a dropdown list which currently has Nexus 4 selected. – Bhav Feb 20 '20 at 16:56
  • Thanks , I have updated an answer , I have selected the **Round** option . You can see that there is no problem with showing . – Junior Jiang Feb 21 '20 at 01:18

2 Answers2

1

quick workaround to recover the designer. After spending a few hours and reinstalling VS I found out that this setting is stored in the Project settings inside the csproj.user file in your projects solution there is a setting called

<AndroidDesignerPreferredDevice>wear_round_454</AndroidDesignerPreferredDevice>

Change this one to

<AndroidDesignerPreferredDevice>wear_round_360_300dpi</AndroidDesignerPreferredDevice>

designer recovers. at least works again but problem remains. What is really interesting is MS didnt document this setting anywhere. you have to dig into yourself and find.

Emil
  • 6,411
  • 7
  • 62
  • 112
0

When selceting the Device option ,from the dropdown list , select Other Form Factors , then you will see Android Wear Round option .

enter image description here

The effect :

enter image description here

Junior Jiang
  • 12,430
  • 1
  • 10
  • 30
  • The items in my drop-down list are different as shown in my screenshot. I can choose the resolution. – Bhav Feb 21 '20 at 09:37
  • @Bhav Hi , sorry for shared image is invalid . You can re-upload it , I will check it . By the way , if you can choose it and also has follow up the [Requirements](https://learn.microsoft.com/en-us/xamarin/android/wear/get-started/installation?tabs=macos#requirements) , I think it will work . – Junior Jiang Feb 24 '20 at 02:30
  • I've uploaded it. – Bhav Feb 24 '20 at 08:23
  • @Bhav Sorry , I only can see [this](https://i.stack.imgur.com/qVrV4.png) without a valid Image . – Junior Jiang Feb 25 '20 at 01:26
  • @Bhav Thanks for re-uploading . Now I can see the image , that's different with mine . I will check it ,and if solution will updare here . – Junior Jiang Feb 26 '20 at 07:55
  • 1
    @Bhav Hi , I have reproduced this issue . And also find it's an issue in GitHub [here](https://github.com/xamarin/xamarin-android/issues/3948) . Although it has beed closed in Github , you also can vote up it in [here](https://developercommunity.visualstudio.com/content/problem/718384/xamarin-android-designer-after-select-specific-dev.html) . – Junior Jiang Feb 26 '20 at 08:29
  • even after 2 years, actually originally error was reported back in 2018, there is another one on Msdn forum but MS keeps ignoring it. I have reinstalled the VS but error is cached somewhere i dont know why and where? And it is per project. When you open a new project, designer works but if you repeat this step to reproduce, it remains for that project only. Did you even find any workaround? it doesnt seem that MS will fix it soon. – Emil Mar 13 '22 at 19:17