Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Xamarin.Android - layout designer blank

Today I opened a project to find that none of its layouts will render in the designer.

enter image description here

I am pretty sure it is not an issue with my AXML as the app works fine when built. Visual Studio is up to date (15.9.9) and will display layouts in other projects without issue. My layouts are in the correct location (Resources/layout). I have tried -

  • Cleaning and rebuilding
  • Deleting the bin/obj folders manually and rebuilding the project
  • Turning Accelerated Rendering on/off in Options/Xamarin/Android UI Designer
  • Opening the project in Visual Studio for Mac (7.8) - same issue
  • Restarting Visual Studio/rebooting my computer

Any ideas on how to fix this would be greatly appreciated. I am not sure what part of the source would be useful to help with answering this question so please ask and I will provide.

Note - this project is on TFS.

like image 706
Oliver Dalton Avatar asked Mar 15 '19 14:03

Oliver Dalton


3 Answers

This happened to mine and a colleague's Visual Studio a while ago, it was working then it was blank. We tried changing the target framework but couldn't get it working, I even completely reinstalled VS.

In our cases turning off "Enable Accelerated Rendering" in Tools > Options > Xamarin > Android UI Designer worked and we can now see the app as we build it. We didn't change the setting so assume it's the default, which makes me think it was caused by a VS update.

like image 84
Mr Chops Avatar answered Nov 01 '22 04:11

Mr Chops


I have often run into this problem as well. Unfortunately, I have not found an easy fix to this problem other than restarting all instances of Visual Studio (and Android Studio if you have that running as well) followed by a full restart of my computer. Hopefully this help, good luck.

like image 1
samyap Avatar answered Nov 01 '22 04:11

samyap


I found that the issue was caused by the target framework version of the app being set to Android 9.0. Setting this to 8.0 to match the version used by the designer fixed the issue.

enter image description here

I need the target framework to be version 9.0 and I can't figure out how to add versions to the designer (8.0 is the only one available to me). I have asked another question in regards to this (see here).

like image 1
Oliver Dalton Avatar answered Nov 01 '22 03:11

Oliver Dalton