Locally, I can build and run my Xamarin Forms application with no issues. In my Azure build pipelines I have my master branch failing because of my target framework version. It says it is 9.0 when it should be at least 10.0.
In my Android project file I have the framework version set to 10.0. I have made sure it is also v10 in the properties tab for the project. Yet I still get the below error.
##[error]C:\Users\VssAdministrator\.nuget\packages\xamarin.forms\5.0.0.2012\build\Xamarin.Forms.targets(188,5): Error XF005: The $(TargetFrameworkVersion) for MyApp.Android (v9.0) is less than the minimum required $(TargetFrameworkVersion) for Xamarin.Forms (10.0). You need to increase the $(TargetFrameworkVersion) for MyApp.Android.
Try to open your .csproj file,and manually modify its targetFrameworkVersion.
<TargetFrameworkVersion>v10.0</TargetFrameworkVersion>
Verify that BOTH of the following project properties are set to 10.0:
Application / Compile using Android version (Target Framework).
Android Manifest / Target Android version.
https://learn.microsoft.com/en-us/xamarin/android/app-fundamentals/android-api-levels
If those are already both 10.0, then make sure the Azure build pipeline has up-to-date versions of Android SDKs and tools.
Another way to fix:
If you are able to create a new sample solution, and successfully build that via Azure, then start a new solution, and add all your files to it.
Related
I have a Xamarin.Forms app (only doing things for Android now) where I added a project from an UWP app. With this, I get two erros which I cannot solve. I've found some things on the internet, but nothing for my specific situation.
The erros are:
Project UWP.Project is not compatible with netstandard2.0 (.NETStandard,Version=v2.0).
Project UWP.Project supports: uap10.0.17763 (UAP,Version=v10.0.17763).
Project UWP.Project is not compatible with monoandroid11.0 (MonoAndroid,Version=v11.0).
Project UWP.Project supports: uap10.0.17763 (UAP,Version=v10.0.17763).
How do I solve this?
I have a Xamarin.Forms app (only doing things for Android now) where I added a project from an UWP app.
It looks you need to update the UWP project target version to 17763. For adding the new platform for existing Forms app, you may refer to this document. And please note making the following changes to UWP MainPage.xaml
Inside the <Page> tag, add: xmlns:forms=“using:Xamarin.Forms.Platform.UWP
I needed to rebuild my fairly ancient Xamarin Forms app from scratch and in the process arrived at a situation where I had a new working iOS app but had needed to delete the draft Android app and start it again. So as a next step I added a vanilla Android app project out of the box and immediately what I saw was that (in MainActivity) Android.Support, Android.Views and Android.Content were undefined with wiggy red lines beneath -- for example in a reference to Android.Support.V7.Widget.Toolbar.
Trying to solve the problem, I set each of Target Framework, Minimum Android Version and Target Android Version to Android 9.0 Pie (API Level 28). In SDK Manager I checked that Android SDK Location and Java SDK Location were 'Found' and that Android SDK Platform 28 was installed.
The following NuGets came installed along with the project, I deleted them and reinstalled them (removing bin/obj folders in between): Xamarin.Android.Support.Core.Utils, Xamarin.Android.Support.CustomTabs and Xamarin.Android.Support.Design.
I tried installing NuGets Xamarin.Android.Support.v7.*. And I added the Xamarin.Forms NuGet. I tried adding 'use' declarations.
None of this helped.
For comparison I separately installed a blank Android app solution-- it worked perfectly out of the box.
Android is pretty new to me - would be grateful for suggestions on fixing this.
The app has a .NET Standard 2.0 project, an iOS project, the (vanilla) Android project (all three with Xamarin Forms), and a .NET Standard 2.0 library project.
I'm using Visual Studio for Mac V8.5.4 (stable) on MacOS 10.15.3.
I noticed that the content of MainActivity.cs is quite different, depending whether the Android project is created separately or as part of a Xamarin Forms solution. Also the provided NuGets are different. So perhaps what I was trying to do, adding an Android app to an existing XF solution, is simply not allowed.
To fix the problem, I created an empty Xamarin Forms solution with Android and iOS projects, added a further empty library project, then in Finder replaced the content of all the project folders, except the Android one, with the content of the corresponding folders in my working solution (the one with a working iOS app).
Migrating to AndroidX is a good idea though.
I don't know if this will help, but you should migrate to AndroidX as soon as possible, nevertheless. Xamarin has migrated to them, starting from Forms 4.5
Here is some more information about the libraries - Introducing AndroidX for Xamarin
There is a special NuGet package for the migration - Xamarin.AndroidX.Migration. Also available is a built-in functionality in Visual Studio - here
What I can suggest is you try to migrate to AndroidX libraries, since the old support libraries won't be supported from now on, and you will surely encounter some issues if not like this one, then something else will pop-up in the future.
We're trying to build a project on Buddy Build using Xcode 10. The project requires building with "legacy build system," but we can't seem to find how to enable this in the build settings in Buddy Build. Any one know how to do this so we can continue to use CI with Buddy Build?
I'm not aware of any way to explicitly select the legacy build system.
We're running our project on xcode 9.4.1 until react native support for the new build system ships (tracking progress here).
If you're working on a react native project there's also a workaround available if you want to keep your BuddyBuild configured on the latest XCode release.
I am using visual studio 2017, created a new xamarin forms project and tried to run the UWP project. It shows the following error:
the project needs to be deployed before it can be started. verify the project is selected to be deployed the solution configuration manager, or deploy it explicitly by clinking one of the deploy commands in the build menu.
I have looked at all online solutions and only found that you need to set the cpu to x86 and to check the deploy checkbox under the configuration manager under the solution. Both these options don't work. I still get the same error. I have also tried every cpu option including ARM.
Have you tried to uninstall the existing UWP app from the Windows Start menu > All apps? Then deploy again from VS. It did the trick for me.
Sometimes when I create an app packet for win store; Visual studio seem to get hung up building to the packet (project needs to be deployed before it can be started -error).
I solve it by creating a new app packet.
I have a Web API that has version 5.1.2 of the Microsoft.AspNet.WebApi.Client package installed.
I am trying to access the API from an ASP.NET MVC application, which also has the same version of the package installed.
However, in the Global.asax of the Web API project, on the line below, I get the following exception:
WebApiConfig.Register(GlobalConfiguration.Configuration);
Attempt by method 'System.Web.Http.HttpConfiguration..ctor(System.Web.Http.HttpRouteCollection)' to access method 'System.Web.Http.HttpConfiguration.DefaultFormatters()' failed.
I found that this error occurs when you have multiple projects pointing to different .net versions.
For example if you have a Web API project targeting .net 4.5 and a unit test project targeting .net 4.5.3 it seems that default settings mean nuget may silently update the .net 4.5 project references to incompatible versions one day when you open visual studio and cause your Web API project to fail with the recondite 'Attempt by method 'HttpConfiguration..ctor(HttpRouteCollection)' to access method 'HttpConfiguration.DefaultFormatters()' failed' error.
To avoid the error drop the higher .net version back on the new project to match the Web API project - for this example right click the unit test project, click properties, then change the target framework to .net framework 4.5.
In my case it was a discrepancy between versions of Microsoft.AspNet.WebApi.Client and Microsoft.AspNet.WebApi.Core, I tried updating both to the same version and it worked.
In my case, the issue was solved when I installed the Microsoft.AspNet.WebApi.Core as well. So three libraries should present and be in harmony (uninstall / install) Microsoft.AspNet.WebApi.Client, Microsoft.AspNet.WebApi.Core and Newtonsoft.json
same for the above answers in my case also it is working good after updating or reinstalling packages
Microsoft.AspNet.WebApi.Client
Microsoft.AspNet.WebApi.Core