12

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

  • 2
    Xamarin Forms still has no support for Android libraries version 23.2.1, it supports as max the 23.0.1.3 version, update only the Xamarin.Forms package and the support libraries will be updated to the correct version. – Gusman Apr 07 '16 at 12:12
  • The problem is, the Android libraries are already at the version 23.2.1. Then do I downgrade them? How? And what about my second part of the question, the 119 errors I'm getting in Android? – Anas Imran Tasadduq Apr 07 '16 at 12:48
  • you can uninstall all android support packages, then re-install xamarin.forms to get the correct versions. After that, clear your Resource.Designer.cs file (the file is in the Android project, open it, clear it's contents and save). The following build will regenerate the Resources file and you should be good to go. – irreal Apr 07 '16 at 13:00
  • So I will uninstall the android packages and Xamarin.Forms through the NuGet Package Manager and reinstall Xamarin.Forms from NuGet Packet Manager too? Or from where? – Anas Imran Tasadduq Apr 07 '16 at 13:03
  • Moreover, if Xamarin.Forms does not support Android libraries 23.2.1, why are the libraries provided by Xamarin, having the name starting with "Xamarin.Android" of the version 23.2.1? Question edited to show the libraries. – Anas Imran Tasadduq Apr 07 '16 at 13:12
  • Just because Forms does not support the most recent version of a library does not mean that Xamarin Android (not using Forms) can't use it. – Jason Apr 07 '16 at 13:39
  • Oh, ok, thanks for telling! I forgot about the Xamarin.Android without using Forms. – Anas Imran Tasadduq Apr 07 '16 at 13:39
  • @irreal I did as you told me. But now I am getting new errors whose screenshot you can see on my edited question. – Anas Imran Tasadduq Apr 07 '16 at 14:49
  • 1
    Try to use the prerelease version of Xamarin Forms. It does support latest android library versions. Btw you have a problem of license. – Softlion Apr 07 '16 at 16:37
  • `MyFifthTry.Droid` That really cracked me up. I'm on my sixth I think... :( – Reinstate Monica Dec 16 '16 at 12:53

1 Answers1

4

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.
Adam
  • 16,089
  • 6
  • 66
  • 109
  • I did that, and both of my errors have gone! But, the warnings included in my screenshot are still coming. I have now four warnings: Two warnings for iOS: XamlCTask failed unexpectedly and Error encountered while loading project. The same two warnings for UWP too. How to get rid of them? – Anas Imran Tasadduq Apr 08 '16 at 02:55
  • Due to these warnings, the android project build and deploy are failing. However, iOS is working fine! It deployed to the iPhone Simulator! – Anas Imran Tasadduq Apr 08 '16 at 03:04
  • Is it just the license error you are having now or different errors? – Adam Apr 08 '16 at 03:23
  • Not the license error, only four warnings, which I mentioned. XamlCTask failing and Error encountered while loading project. On each, iOS and UWP. – Anas Imran Tasadduq Apr 08 '16 at 03:38
  • Have you restarted VS since updating the Xamarin Forms Nuget package? The Nuget package changes the targets file, which requires a VS restart to load again. – Adam Apr 08 '16 at 03:39
  • I've restarted Visual Studio, and it has brought four warnings to two. Now the warnings are coming in Xamarin.iOS only, and Android build is still failing. Errors: XamlCTask failed unexpectedly, and Error enountered while loading the project. Some project features... – Anas Imran Tasadduq Apr 08 '16 at 03:52
  • Afer rebuilding, I've got one error and one warning, both in iOS. Error: No installed provisioning profiles match the installed iOS code signing keys. Warning: Error encountered while loading projects... – Anas Imran Tasadduq Apr 08 '16 at 04:03
  • For the iOS Provisioning Error there is a great answer for that here: http://stackoverflow.com/questions/30724551/no-installed-provisioning-profiles-match-the-installed-ios-code-signing-keys-in – Adam Apr 08 '16 at 04:29
  • Thank you for your active support! No more errors in Visual Studio. However, application still does not launch. Logcat displays this error: Couldn't load memtrack module (No such file or directory). What do I do now? Many answers are there regarding this error but they are for Android development with java and android studio and do not help me. – Anas Imran Tasadduq Apr 08 '16 at 07:36
  • @AnasTasadduq - could you post that error in a new question, its getting a bit crowded in the comment section now. – Adam Apr 08 '16 at 07:45
  • The new question: http://stackoverflow.com/questions/36494498/couldnt-load-memtrack-no-such-file-or-directory-error-in-xamarin-forms-visual – Anas Imran Tasadduq Apr 08 '16 at 08:02
  • Im getting exact same error after updating xf too as ask by a xamarin tutorial. And in getting the similar error that anas is reporting. Im gonna try adam suggestions but will be resolved soon? Kind of worried about stability of xamarin in vs or is it r7ecommended for me to skip vs and just use xamarin studio? – visual Jul 28 '16 at 22:37
  • @visual - its not really an error in Xamarin for Visual Studio, its just that you shouldn't update all the Android support packages as XF needs a very specific version. – Adam Jul 29 '16 at 01:27
  • @AdamPedley I have updated only Xamarin Forms, but when i run the project it gives me lot of errors of `media routers` `card view` etc. When i update them from nuget the form version get to the older version. And then it ask me to restart VS and after restarting VS i am getting `not responding` VS and it goes on until i close it from task manager – Moeez Nov 01 '16 at 06:29