[英]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.