简体   繁体   中英

Xamarin.Forms Android $(TargetFrameworkVersion) error

I upgraded Xamarin.Forms in my old project to v4.5.0.495. When I try to start my app in an Android simulator, I receive the following error:

XF005: The $(TargetFrameworkVersion) for App.Android (v8.1) is less than the minimum required $(TargetFrameworkVersion) for Xamarin.Forms (9.0). You need to increase the $(TargetFrameworkVersion) for App.Android. (XF005)

After this, I increased the version in the project options to Android 10.0 (API level 29), but the error occurs again. VS is up to date. Has anyone experienced the same error?

Posting this as an answer for other people since I almost missed it in the comments. Credit to @FreakyAli

Right-click on Android Project>Properties>Application>Compile using Android version change this to v9 or above and see if that works

On VS Mac it can be found on the General section. (right click android project>Options>General)

I resolved by adding making below settings under Android Project-->Properties and changing target versions应用程序设置 Android 清单设置

I had to manually change the references to the TargetFrameworkVersion in the csproj file to get it to update properly. For some reason there were several references to this value in the .csproj file, all with different values!

I was getting this error message:

error XF005: The $(TargetFrameworkVersion) for TripLog2.Android (v9.0) is less than the minimum required $(TargetFrameworkVersion) for Xamarin.Forms (10.0). You need to increase the $(TargetFrameworkVersion) for TripLog2.Android.

Going to Android project properties, I had two new versions available in target framework. They both has * sign next to them which means they require update.

I pcked the latest which was 11 but that created another set of errors. However Selecting version 10 worked. I did had to quit Visual Studio 2019 and restart it for my project to build fine again. Without it, error will not go away.

在此处输入图片说明

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM