Xamarin.Forms Android Build/Deploy failed

IosifIosif ROMember
edited May 2016 in Xamarin.Forms

Hi,

I am new to Xamarin and Xamarin.Forms. I am trying to start an Xamarin.Forms (Portable) project and when I am trying to deploy for Android I get some missing resources errors (Build log attached).

I also searched for a solution and after trying removing NuGet Packages (all are up to date) and reinstalling, deleting %appdata% local xamarin folders as described in this solution, but still getting the same error.

Can you help me fix it?

[EDIT]
I have Android SDK installed by Android Studio but updated and Xamarin Settings pointing to it's location.

Thank You!

Br,
Iosif

Posts

  • AdamPAdamP AUUniversity ✭✭✭✭✭

    @Iosif - Go to your resource.designer.cs file, delete everything inside it and then rebuild. Normally the Resource.Designer.cs doesn't regenerate when it should.

    Also do a restart of VS if you have recently installed a new XF Nuget package and not restarted VS yet.

  • IosifIosif ROMember

    @AdamP
    It worked by clearing Resources.Designer.cs

    I would also like to ask you how can I use OnPlatform in XAML, in Xamarin.Forms (Portable) project, in case of UWP app, I found on the forum for Android iOS and WP, but not UWP.

    Thank You!

    Br,
    Iosif

  • AdamPAdamP AUUniversity ✭✭✭✭✭
    edited May 2016

    @Iosif - Device.OnPlatform is unofficially(at the moment) going to be obsoleted in the near future as everytime they add a new platform that API breaks. As such we will need to use Device.OS (TargetPlatform).

    This is an enum. As for doing it in XAML, there are few ways (I haven't tried either of these yet).

    1. Create your own OnPlatform method, with the required attributes
    2. Use a ValueConverter
    3. Use DataTriggers (that is a WPF example, will need to convert to XF Triggers but they look almost identical
Sign In or Register to comment.