简体   繁体   English

为什么在 Visual Studio 2019 (XAMARIN) 中找不到 Android 库

[英]Why are Android libraries not found in Visual Studio 2019 (XAMARIN)

I was working on a project a few days ago and everything was ok.几天前我在做一个项目,一切都很好。 I just got a new PC a couple days ago and I wanted to work on it, but for some reason all Android libraries were not found.几天前我刚买了一台新电脑,我想在上面工作,但由于某种原因,没有找到所有 Android 库。 For example:例如:

using Android.Content;
using Android.Net;

I had both Java and Android SDK installed and in my system path env.我在我的系统路径环境中安装了 Java 和 Android SDK。 I also noticed this weird yellow warning in my Dependencies -> Assemblies -> Mono.Android我还在我的 Dependencies -> Assemblies -> Mono.Android 中注意到这个奇怪的黄色警告

I'm posting the solution because it took me two full days to figure out the solution.我发布解决方案是因为我花了整整两天时间才找到解决方案。

If you go to yourprojectname.csproj file you can se this:如果你 go 到 yourprojectname.csproj 文件,你可以这样:

<ItemGroup>
    <Reference Include="Mono.Android">
      <HintPath>..\..\..\..\..\..\..\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\IDE\ReferenceAssemblies\Microsoft\Framework\MonoAndroid\v9.0\Mono.Android.dll</HintPath>
    </Reference>
  </ItemGroup>

And this is the problem.这就是问题所在。 The path to the Mono.Android.dll was never found, as my Visual Studio installation was on C:/... while my project was on D:/... The path to the Mono.Android.dll was never found, as my Visual Studio installation was on C:/... while my project was on D:/...

On my old laptop I only had one disk so the problem never occured.在我的旧笔记本电脑上,我只有一个磁盘,所以问题从未发生过。 I fixed this by moving my project to the same disk that my Visual Studio installation is on (in my case to C:/... )我通过将我的项目移动到我的 Visual Studio 安装所在的同一个磁盘来解决这个问题(在我的情况下是 C:/...)

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

相关问题 为什么我在 Xamarin Visual Studio 2019 中缺少 Android UI 元素 - Why am I missing Android UI elements in Xamarin Visual Studio 2019 Visual Studio 社区 2019 更新影响 Xamarin - Visual Studio Community 2019 Update affects Xamarin Xamarin.Forms:Android 问题。重新安装 Visual Studio 2019 后的图形 - Xamarin.Forms : issue with Android.Graphics after reinstall Visual Studio 2019 创建项目 Visual Studio 2019 时缺少 Xamarin.Android class 库 - Xamarin.Android class library missing when create project Visual Studio 2019 Xamarin Visual Studio中没有Android工具 - No Android Tools in Xamarin Visual Studio Xamarin Forms 不再在 Visual Studio 2019 Preview 16.10.0 中部署 AppIcon - Xamarin Forms no longer deploying AppIcon in Visual Studio 2019 Preview 16.10.0 Xamarin (Visual Studio 2019) Xaml 预览器不适用于 Windows 或 Mac - Xamarin (Visual Studio 2019) Xaml Previewer Not working on Windows or Mac Visual Studio mac 2019(社区) - PresentationCore - 未找到 .Net Framework 4 的程序集 - Visual Studio mac 2019 (Community) - PresentationCore - Assembly not found for .Net Framework 4 Visual Studio 2019 - COM 异常:找不到成员 0x80020003 - Visual Studio 2019 - COM Exception: Member not found 0x80020003 在 Visual Studio 2019 (C#) 中未找到 MqttMsgSubscribe.cs 错误 - MqttMsgSubscribe.cs not found Error in Visual Studio 2019 (C#)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM