Xamarin.Forms 不编译 Android 项目 [英] Xamarin.Forms does not compile an Android Project

查看:31
本文介绍了Xamarin.Forms 不编译 Android 项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

同样,在 Mac 上更新到 VS 8.9.1 后,我在尝试编译我的 Android 项目时遇到此错误:

Again, after updating to VS 8.9.1 on Mac I'm getting this error while trying to compile my Android project:

    /Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Tooling.targets(5,5): Error XARSD7023: System.IO.DirectoryNotFoundException: Could not find a part of the path '/Users/giulioserra/Library/Android/sdk'.
  at System.IO.Enumeration.FileSystemEnumerator`1[TResult].CreateDirectoryHandle (System.String path, System.Boolean ignoreNotFound) [0x00032] in <36514b14425c4337b446653c547aa9c3>:0 
  at System.IO.Enumeration.FileSystemEnumerator`1[TResult]..ctor (System.String directory, System.IO.EnumerationOptions options) [0x00048] in <36514b14425c4337b446653c547aa9c3>:0 
  at System.IO.Enumeration.FileSystemEnumerable`1+DelegateEnumerator[TResult]..ctor (System.IO.Enumeration.FileSystemEnumerable`1[TResult] enumerable) [0x00000] in <36514b14425c4337b446653c547aa9c3>:0 
  at System.IO.Enumeration.FileSystemEnumerable`1[TResult]..ctor (System.String directory, System.IO.Enumeration.FileSystemEnumerable`1+FindTransform[TResult] transform, System.IO.EnumerationOptions options) [0x00042] in <36514b14425c4337b446653c547aa9c3>:0 
  at System.IO.Enumeration.FileSystemEnumerableFactory.UserDirectories (System.String directory, System.String expression, System.IO.EnumerationOptions options) [0x00014] in /Users/builder/jenkins/workspace/build-package-osx-mono/2020-02/external/bockbuild/builds/mono-x64/external/corefx/src/System.IO.FileSystem/src/System/IO/Enumeration/FileSystemEnumerableFactory.cs:104 
  at System.IO.Directory.InternalEnumeratePaths (System.String path, System.String searchPattern, System.IO.SearchTarget searchTarget, System.IO.EnumerationOptions options) [0x00045] in /Users/builder/jenkins/workspace/build-package-osx-mono/2020-02/external/bockbuild/builds/mono-x64/external/corefx/src/System.IO.FileSystem/src/System/IO/Directory.cs:180 
  at System.IO.Directory.EnumerateDirectories (System.String path, System.String searchPattern, System.IO.EnumerationOptions enumerationOptions) [0x00000] in /Users/builder/jenkins/workspace/build-package-osx-mono/2020-02/external/bockbuild/builds/mono-x64/external/corefx/src/System.IO.FileSystem/src/System/IO/Directory.cs:196 
  at System.IO.Directory.EnumerateDirectories (System.String path, System.String searchPattern, System.IO.SearchOption searchOption) [0x00000] in /Users/builder/jenkins/workspace/build-package-osx-mono/2020-02/external/bockbuild/builds/mono-x64/external/corefx/src/System.IO.FileSystem/src/System/IO/Directory.cs:193 
  at Xamarin.Android.Tools.AndroidSdkBase.FindBestNDK (System.String androidSdkPath) [0x00038] in /Users/builder/azdo/_work/278/s/xamarin-android/external/xamarin-android-tools/src/Xamarin.Android.Tools.AndroidSdk/Sdks/AndroidSdkBase.cs:172 
  at Xamarin.Android.Tools.AndroidSdkBase+<GetAllAvailableAndroidNdks>d__73.MoveNext () [0x000d0] in /Users/builder/azdo/_work/278/s/xamarin-android/external/xamarin-android-tools/src/Xamarin.Android.Tools.AndroidSdk/Sdks/AndroidSdkBase.cs:164 
  at Xamarin.Android.Tools.AndroidSdkBase.GetValidNdkPath (System.String ctorParam) [0x00068] in /Users/builder/azdo/_work/278/s/xamarin-android/external/xamarin-android-tools/src/Xamarin.Android.Tools.AndroidSdk/Sdks/AndroidSdkBase.cs:128 
  at Xamarin.Android.Tools.AndroidSdkBase.Initialize (System.String androidSdkPath, System.String androidNdkPath, System.String javaSdkPath) [0x00061] in /Users/builder/azdo/_work/278/s/xamarin-android/external/xamarin-android-tools/src/Xamarin.Android.Tools.AndroidSdk/Sdks/AndroidSdkBase.cs:71 
  at Xamarin.Android.Tools.AndroidSdkInfo..ctor (System.Action`2[T1,T2] logger, System.String androidSdkPath, System.String androidNdkPath, System.String javaSdkPath) [0x00025] in /Users/builder/azdo/_work/278/s/xamarin-android/external/xamarin-android-tools/src/Xamarin.Android.Tools.AndroidSdk/AndroidSdkInfo.cs:18 
  at Xamarin.Android.Tasks.MonoAndroidHelper.RefreshAndroidSdk (System.String sdkPath, System.String ndkPath, System.String javaPath, Microsoft.Build.Utilities.TaskLoggingHelper logHelper) [0x00005] in <e0b267300cf54583bbaa8d3ab5dc4081>:0 
  at Xamarin.Android.Tasks.ResolveSdks.RunTask () [0x000ac] in <e0b267300cf54583bbaa8d3ab5dc4081>:0 
  at Xamarin.Android.Tasks.AndroidTask.Execute () [0x00000] in <e0b267300cf54583bbaa8d3ab5dc4081>:0  (XARSD7023) (HangoverBusiness.Android)

我尝试删除bin和obj文件但没有,这个问题只在Android项目中表现出来,而IOS版本工作正常.

I tried to delete bin and obj files but nothing, this problem only manifests in the Android project, while the IOS version works fine.

环境:Mac OS CatalinaVS 8.9.1

Env: Mac OS Catalina VS 8.9.1

有什么提示吗?

推荐答案

解决方法现已添加到预发布版中.

Workaround is now added in prerelease.

https://docs.microsoft.com/en-us/visualstudio/releasenotes/vs2019-mac-preview-relnotes

解决方法:- 在某些情况下,Android 项目可能无法构建并出现错误 The Java SDK could not be found,请在 Xamarin.Android SDKs 设置中设置它的路径控制板.解决方法是在终端中执行以下命令:

mkdir -p ~/Library/Android/sdk

这篇关于Xamarin.Forms 不编译 Android 项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆