Bug 54358 - Failed to render Android XAML preview
Summary: Failed to render Android XAML preview
Alias: None
Product: Visual Studio Extensions
Classification: Xamarin
Component: Xamarin.Forms Previewer ()
Version: unspecified
Hardware: PC Windows
: --- normal
Target Milestone: ---
Assignee: Bugzilla
Depends on:
Reported: 2017-03-31 20:50 UTC by Edward Brey
Modified: 2017-04-18 10:35 UTC (History)
4 users (show)

Is this bug a regression?: ---
Last known good build:

Diagnostics (3.72 KB, application/x-zip-compressed)
2017-04-03 19:38 UTC, Edward Brey

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Please create a new report on Developer Community with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:

Description Edward Brey 2017-03-31 20:50:48 UTC
Attempting to preview a trivial ContentPage with a single button in Forms Previewer results in the error, "Failed to render Android XAML preview". This is on a project with an Android target, but no iOS target (so #45142 would apply, but its fix should be in place).

The ContentPage in a PCL project.

Comment 1 Alan McGovern 2017-04-02 12:22:17 UTC
Can you attach the logs from the session which failed? I believe you can get them by clicking Help -> Xamarin -> Zip Xamarin logs. 

there have also been a lot of changes between the 4.3 release and the 4.4 release. If possible I would recommend you try the latest preview release of the Xamarin tools as the issue could already be fixed. You can get info about the new releases here: https://forums.xamarin.com/discussion/90944/beta-channel-and-vs-preview-15-1-aka-cycle-10-feature-preview
Comment 2 Edward Brey 2017-04-03 19:38:46 UTC
Created attachment 21161 [details]

2017-04-02_02-43-26.1468.Ide.log mentions the minimum SDK level. The API level for the project is API Level 15.
Comment 3 Alan McGovern 2017-04-03 20:23:24 UTC
I believe you've hit the same issue as many other people. The only workaround for now is this: https://bugzilla.xamarin.com/show_bug.cgi?id=53891#c3

If that does not help please re-open the bug and we'll address it as soon as possible.
Comment 4 Edward Brey 2017-04-05 00:28:32 UTC
I have Android Xamarin.Android SDK (3a62f1e) installed, as per 53891, but I still get the error.
Comment 5 Alan McGovern 2017-04-05 09:32:27 UTC
Can you supply new log files now that you've installed the Android SDK manually? If everything went well i believe this file should now exist, C:\Program Files (x86)\MSBuild\Xamarin\Android\libmonosgen-2.0.dll, which means you should not have the *exact* same error in the logs.
Comment 6 Edward Brey 2017-04-05 11:20:20 UTC
The log files are the same, with very little data. There is no "C:\Program Files (x86)\MSBuild\Xamarin" folder.

It looks like the issue has to do with installation and versioning. I hadn't installed anything besides Microsoft's Visual Studio update before running the test in my previous comment. That seemed like enough, based on this technical bulletin that indicates that Visual Studio 2017 15.0.26228.12 obsoletes the manual installs:

It seems like something more is needed, however. The workaround comment on bug #53891 references version Xamarin, which is out of date. I'm running Is there a manual download for the current version that I'm supposed to install a portion of?
Comment 7 Alan McGovern 2017-04-05 12:44:25 UTC
If that directory doesn't exist then the android SDK was not installed as expected. The best option at this point is probably to wait for our next stable release. It's due very soon and things should work out of box with that.

If you cannot wait for that then can you confirm that you installed just the `Xamarin.Android SDK` portion of the linked installer? That's the portion that should create that directory. I know it is a slightly out of date installer at this point, but the only user of files installed by that installer will be the android portion of the previewer and the binaries will be compatible with your slightly newer build.
Comment 8 Alan McGovern 2017-04-05 12:46:20 UTC
Also, just to be clear, the usage of the manual installer is just a workaround while we wait for the actual fix to be released. Once the 15.1 update ships you will not need to use a manual installer.
Comment 9 Alan McGovern 2017-04-18 10:35:37 UTC
I believe the fix has now shipped with the current stable release.