简体   繁体   English

Xamarin.Forms Android $(TargetFrameworkVersion) 错误

[英]Xamarin.Forms Android $(TargetFrameworkVersion) error

I upgraded Xamarin.Forms in my old project to v4.5.0.495.我将旧项目中的 Xamarin.Forms 升级到 v4.5.0.495。 When I try to start my app in an Android simulator, I receive the following error:当我尝试在 Android 模拟器中启动我的应用程序时,我收到以下错误:

XF005: The $(TargetFrameworkVersion) for App.Android (v8.1) is less than the minimum required $(TargetFrameworkVersion) for Xamarin.Forms (9.0). XF005:App.Android (v8.1) 的 $(TargetFrameworkVersion) 小于 Xamarin.Forms (9.0) 所需的最低 $(TargetFrameworkVersion)。 You need to increase the $(TargetFrameworkVersion) for App.Android.您需要为 App.Android 增加 $(TargetFrameworkVersion)。 (XF005) (XF005)

After this, I increased the version in the project options to Android 10.0 (API level 29), but the error occurs again.此后,我在项目选项中将版本提高到Android 10.0(API级别29),但错误再次出现。 VS is up to date. VS 是最新的。 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归功于@FreakyAli

Right-click on Android Project>Properties>Application>Compile using Android version change this to v9 or above and see if that works右键单击Android Project>Properties>Application>Compile using Android version 将此更改为v9或更高版本,看看是否有效

On VS Mac it can be found on the General section.在 VS Mac 上,它可以在 General 部分找到。 (right click android project>Options>General) (右键单击android项目>选项>常规)

I resolved by adding making below settings under Android Project-->Properties and changing target versions我通过在 Android Project-->Properties 和更改目标版本下添加以下设置来解决应用程序设置 Android 清单设置

I had to manually change the references to the TargetFrameworkVersion in the csproj file to get it to update properly.我必须手动更改 csproj 文件中对 TargetFrameworkVersion 的引用才能使其正确更新。 For some reason there were several references to this value in the .csproj file, all with different values!出于某种原因,在 .csproj 文件中有多个对该值的引用,所有引用都具有不同的值!

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).错误 XF005:TripLog2.Android (v9.0) 的 $(TargetFrameworkVersion) 小于 Xamarin.Forms (10.0) 所需的最低 $(TargetFrameworkVersion)。 You need to increase the $(TargetFrameworkVersion) for TripLog2.Android.您需要为 TripLog2.Android 增加 $(TargetFrameworkVersion)。

Going to Android project properties, I had two new versions available in target framework.转到 Android 项目属性,我在目标框架中有两个可用的新版本。 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.我找到了最新的 11 个,但这又产生了另一组错误。 However Selecting version 10 worked.但是选择版本 10 有效。 I did had to quit Visual Studio 2019 and restart it for my project to build fine again.我确实不得不退出 Visual Studio 2019 并重新启动它,我的项目才能再次正常构建。 Without it, error will not go away.没有它,错误就不会消失。

在此处输入图片说明

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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