Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Xamarin.Droid causing build errors in Visual Studio 2015 when using Xamarin.Forms

Recently, I've started learning to develop mobile apps using Xamarin.Forms through a book. I created an application "Hello", which had six projects, one Portable Shared Library project, one Android, one iOS and three Windows (two for Windows 8 and Windows 8 Phone and one for Windows 10 UWP). I was getting NuGet package updates, and my problems started from there.

First problem:

The updates were mainly of the Android Support Libraries, but one was of Xamarin.Forms. All of them got updated except for this one. All of my Android Support Library packages are updated to v23.2.1. I got the following error while trying to update Xamarin.Forms:

Error while trying to update Xamarin.Forms

So I decided not to update, and then went on to build the project (the only modification I made was in App.cs, changing XAlign to HorizontalTextAlign because I got a warning in the error list to do that, rest all the code was present already as it is) and here comes my second problem:

I got 119 errors from Hello.Droid and 2 warnings from Hello.iOS, 1 warning from Hello.WinPhone, 1 warning from Hello.Windows and 1 warning from Hello (Hello is my App name). Below are the screenshots:

Errors after the build

Errors and warnings after the build

Errors not visible in the screenshots have the code CS0117 and have description starting with: "'Resource.Stylable' does not contain... etc."

I don't understand what is causing these errors and what is the solution for them. The only reason to post my question here is that I was not able to find a solution to my problem on the internet. I've searched a lot.

Help would be appreciated.

P.S. I've got to know that Xamarin experts are trying to help developers at this site, so I request them to try to help me too.

If any more information is needed, just tell me, I'll provide it.

Thanks in advance.

EDIT: These are the Android support packages: Android Support Packages

EDIT 2: Screenshot of the new errors: Errors after reinstall

This question continues here: Part 2

like image 968
Anas Imran Tasadduq Avatar asked Apr 07 '16 11:04

Anas Imran Tasadduq


People also ask

Why can’t I install Android support libraries in Xamarin forms?

Your Android Support libraries might be out of sync with your Xamarin Forms version. For example the Android Support libraries shouldn’t be updated to the latest version. Xamarin Forms normally depends upon an older version. These versions are exact (=) not (>=). Unzipping failed.

How to setup Visual Studio 2015 (update 3) to work with Xamarin forms?

Follow the steps, mentioned below to setup your Visual Studio 2015 (Update 3) to work with Xamarin Forms. Open Visual Studio 2015 setup from Windows Control Panel and install all the features of Cross Platform Mobile Development. Restart the machine, install all the updates from Windows Update as necessary.

Can Xamarin developers write C++ in Visual Studio?

Through our collaboration with the Visual C++ Cross-Platform Mobile team at Microsoft, Xamarin developers in Visual Studio now have the power to write, compile, debug, and reference C/C++ projects in Xamarin.Android from within their favorite IDE.

How do I Fix my Xamarin app that won't deploy?

In Visual Studio you can go to Tools > Options, then Xamarin > Android Settings. Then update the location of your JDK. If you build successfully yet it doesn’t deploy either due to an actual outputted failure or it just seems to freeze and not deploy here are some things to try: Put the application into release mode, then deploy.


1 Answers

The initial errors you were getting are because Xamarin Forms only supports 23.0.1.3. With XF 2.2.0-pre1 they have updated to 23.1.1.1 but its still not the latest.

To remove these errors, I would uninstall all Google support packages and Xamarin Forms. Then just download Xamarin Forms and it will install the correct version.

The best option is to never to an Update All in Xamarin in the future.

Then after this is done the Resource.Designer.cs file might still cause some issues. As such, go to that file, delete everything inside of it and then rebuild the project again.

As for your licensing errors, make sure you update to the latest version of Xamarin.

  1. Go to Tools > Options
  2. Then go to Xamarin > Other
  3. Then press Update and go through the install.
  4. Then restart VS and you should have those licensing errors removed now that Xamarin is free with Visual Studio.
like image 54
Adam Avatar answered Sep 18 '22 06:09

Adam