Multiple errors after updating Xamarin Forms - xamarin

I'm using Visual Studio 2017, and I stared a new Xamarin Forms app:
Create New project - Cross Platform App (Xamarin)
Blank App, and I chose Portable Class Library (PCL)
The app compiles and runs.
Now I right click the solution and choose Manage Nuget packages for solution, and it tells me I'm running version 23.3.0 and I should update to 25.4.0.1
After the update and 3 VS reboots, it gives me a host of errors I have been trying to solve for an hour including googling.
All theme related.
I tried removing the styles.xml file all together. I removed the theme from the reference to the theme from the manafest and it keeps putting it back.
I can't figure out what I'm doing wrong. I have not written any code.

Xamarin Forms requires a specific version of the Android Support libraries. Do not update them.
Delete your project and create a new one.
It is possible to get round this limitation by ensuring you are using a specific version of Android and by updating all Android SDK's, but for a beginner I would recommend just using the support libraries that are installed alongside Xamarin Forms.

Related

UWP store build with Xamarin Forms

We are having trouble publishing our x86/x64 UWP Xamarin Forms app to the Microsoft Store.
The app got rejected because the certification team cannot test the .appxupload package because it crashes on startup.
The app only crashes when installed from the store built .appxupload package. The .appxbundle in _Test works fine and we are using it for in-house distribution and sideloading via HockeyApp.
At first we assumed that the crash was due to faulty packaging as our app uses the desktop-bridge feature to bundle a small WPF executable with it. Our first instinct was to remove the desktop bridge part and test the packaging again. After removing it, we had the same issue, the .appxupload crashed on start.
We took it one step forward and just created a new solution with a new Xamarin Forms Template project (VS 15.7.1). Without changing a single line of code we packaged the visual studio xamarin forms uwp template project for store upload. The surprise here is that the generated .appxupload also crashes exactly the same way on startup.
We decided to find out more by experimenting on the Visual Studio XF uwp template:
Update XF to 3.1 -> still crashes
Update .NETCore.UniversalWindows to 6.1.5 -? still crashes
Remove XF from the project completely (including Xamarin.Forms.Init(..)) -> no more crash, but also no more content without Xamarin forms ... :(
We have researched the following posts which seem to be related to this issue:
https://bugzilla.xamarin.com/show_bug.cgi?id=59538
https://developercommunity.visualstudio.com/content/problem/150965/xamarin-forms-project-uwp-app-dies-on-start-when-i.html
Could not load file or assembly 'System.Private.CoreLib...'
Some of the above posts were explaining that even though the .appxupload crashes when installed locally the when downloaded and installed from the Microsoft store the package will run without a problem. Our problem with this part is that our .appxupload package needs to be tested by Microsoft before the store publish because of the desktop bridge permission. Because it crashes when locally testing it cannot be published.
Based on our experiments with the Visual Studio Xamarin forms uwp template project this seems to be an issue of UWP and Xamarin Forms together.
We are not sure how to proceed. We need to get the app running from the .appxupload package so that it can be tested by the store team. Do you have any ideas/solutions for this issue?

Visual Studio App Center Android Build Project not finding Solution Files

I am trying out the new Visual Studio App Center for a mobile app I am writing.
I have three solutions checked into VSTS Git. The first solution named App.sln is a master solution that has 2 solution folders, Apps and Services. The Apps folder has 3 projects App.csproj which is a .NET Standard 2.0 library containing the Xamarin Forms shared code. App.iOS.csproj is the Xamarin Forms iOS project. Finally, App.Droid.csproj is the Xamarin Forms Android project. The Services folder contains project files written in ASP.NET Core 2. The second solution is a solution named App.iOS.sln containing just the iOS and App library projects. The last is a solution named App.Droid.sln containing just the Android and App library projects.
In App Center I have 2 Apps configured per the instructions for Xamarin Forms apps. The first is an App configured as iOS Xamarin app. The second App is configured as Android Xamarin app.
I configured the analytics and crash reporting which works. I then configured the builds and this is where I have run into an issue. Specifically the Android build configuration project drop down only sees the App.Droid project. The iOS App build configuration project drop down sees all three solutions but only the App.iOS project. I selected the App.Droid and App.iOS projects. It seems to work. However I'm concerned that in the future things might break. I rather select the App.iOS and App.Droid solutions. That way I know that the correct projects are compiled and nothing not need is compiled. This is especially true since I am trying to stay within the free compile time budget until the MVP is done. Any ideas how to accomplish ensuring only the right projects are compiled?
According to App Center team (on Jan 30, 2018):
Unfortunately we do not support the selection of sln's with Android
Xamarin, currently solution file is only supported for iOS.

Can not compile after migrating unified api in xamarin forms

We have migrated the xamarin forms project to unified api.
But we have the strange compile error like this:
Could not AOT the assembly '.../iOS/obj/iPhone/Debug/mtouch-cache/Build/Xamarin.Forms.Labs.dll
So I changed the settings in iOS project's options.
In ios Build Tab of Project options(iOS) I changed the "don't link" to "Link all assemblies".
But the app is crashed when it is started.
xamarin version is 5.7.1(build 17).
xamarin forms's version is 1.3.5.6337.
xamarin forms labs's version is 1.0.1.5.
Please help me if you have the experience with this error.
Replace Xamarin.Forms.Labs with XLabs.Forms.
There has been a major refactoring on how the XLabs project is structured so your existing project based on the 1.x.x will break. The reason for the refactoring was simple; separate functionality that does not depend on Xamarin.Forms into different assemblies. This allows the use of functionality like IoC, Serialization and even platform specific services without referencing XF.
To upgrade:
Uninstall any existing Xamarin.Forms.Labs packages from your
project.
Install XLabs.Forms package to your projects (PCL, iOS, Droid & WP). This will update Xamarin.Forms to the latest stable release (1.4.x)
Refactor code to reference the correct namespaces.

error : Error initializing task XamlG: Not registered task XamlG

I am developing a Xamarin Forms (PCL) application for IOS and Android Platform.
My Xamarin Studio version is 5.5.4 (Build 15). I am on stable channel.
My Xamarin Forms dll version is 1.3.0.6292.
I have also added a Xamarin Forms Labs reference from NuGet, v1.2.0.
Since yesterday, whenever i am building the solution, i get following error:
error : Error initializing task XamlG: Not registered task XamlG.
Any possible resolution for this error? I have tried clean and build multiple time. Even deleted the entire source code and redownloaded everything from source control but same error.
This error can occur if you have upgraded from an older version of Xamarin.Forms to a newer version. The underlying problem is that the wrong Xamarin.Forms.Build.Tasks.dll is being loaded compared with the one that the custo MSBuild Xamarin.Forms.targets file is expecting.
There is a bug in Xamarin Studio where the old build Xamarin.Forms build tasks are still used after the NuGet package has been upgraded. You can workaround this by closing and re-opening the solution.
However you say you have deleted the source code and downloaded everything again so it sounds like you have a different problem. It may be that your project is trying to use two different versions of Xamarin.Forms at the same time. I would look at your project files (.csproj) in a text editor and make sure they are all using one version of Xamarin.Forms. Check that they are all referencing a single version of Xamarin.Forms.targets and it is the same version.
This is silly.
I just recloned the project in a new fresh folder and build it from scratch and it worked. The more i am using Xamarin Forms, the more buggy and unbaked it seems. There are random issues which get fixed just by rebuilding the project. Or like Matt pointed in his answer below, by just restarting the studio. In my programming experience with different IDEs and platforms, only Xamarin seems to have these problems regularly.

Xamarin: Unable to add HotTuna.StarterPack

I am trying to install the MVVMCross.HotTuna.StarterPack on my Xamarin (Mac) Solution using the NuGet, but i ain't successful. The package was installed in the Xamarin.Android project successfully but while i try the same to do with the iOS and PCL project, it doesn't add. Any Idea on whats going wrong? Thanks!
That nuget package requires nuget 2.5 which isn't yet finished/released for Xamarin Studio - track https://github.com/mrward/monodevelop-nuget-addin/issues/13 for updates
It will also probably require fixes from Xamarin - they've not yet released PCL support, but it is in development. You can ask their forum and/or support for updates on this.
In the meantime:
you can develop for MvvmCross using VS on the PC - see http://mvvmcross.wordpress.com/
you can develop using binaries (not nuget) on the Mac - see http://slodge.blogspot.com/2013/05/xamarin-studio-quick-run-through-for.html
For Xamarin.Mac/MonoMac support, there's no PCL support currently available - so the only way to get this working currently is to fork the MvvmCross solution and to compile the PCL libraries for the appropriate Mac project. For more on current .Mac issues, track and/or contribute to: http://forums.xamarin.com/discussion/3733/playing-with-pcls

Resources