存档 Xamarin Android 应用程序会出现错误 XABLD7019 [英] Archiving Xamarin Android App gives error XABLD7019

查看:23
本文介绍了存档 Xamarin Android 应用程序会出现错误 XABLD7019的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

VS 2019 版本 16.7.1,Xamarin Forms v4.8.0.1269

VS 2019 Version 16.7.1, Xamarin Forms v4.8.0.1269

以前工作过,但现在归档 Android 应用程序失败(iOS 正常).我已经更新了 Android SDK.

Worked previously, but archiving the Android App now fails (iOS OK). I have updated the Android SDK.

错误是(日志记录设置为诊断):

The error is (logging set to diagnostic):

XABLD7019: System.UnauthorizedAccessException: Access to the path 'C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\IDE\ReferenceAssemblies\Microsoft\Framework\MonoAndroid\v1.0\Java.Interop.dll.lz4' is denied.
   at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
   at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)
   at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share)
   at Xamarin.Android.Tasks.AssemblyCompression.Compress(AssemblyData data)
   at Xamarin.Android.Tasks.BuildApk.<AddAssemblies>g__CompressAssembly|138_1(ITaskItem assembly, <>c__DisplayClass138_0& )
   at Xamarin.Android.Tasks.BuildApk.AddAssemblies(ZipArchiveEx apk, Boolean debug, Boolean compress, IDictionary`2 compressedAssembliesInfo)
   at Xamarin.Android.Tasks.BuildApk.ExecuteWithAbi(String[] supportedAbis, String apkInputPath, String apkOutputPath, Boolean debug, Boolean compress, IDictionary`2 compressedAssembliesInfo)
   at Xamarin.Android.Tasks.BuildApk.RunTask()
   at Xamarin.Android.Tasks.AndroidTask.Execute()

该文件夹中有一个名为Java.Interop.dll"的文件,但没有一个名为Java.Interop.dll.lz4"的文件.

There is a file in that folder called 'Java.Interop.dll', but not one called 'Java.Interop.dll.lz4'.

有没有人对可能导致这种情况的原因有任何想法?

Does anyone have any ideas as to what may be causing this?

推荐答案

更新:升级到 Visual Studio 16.7.5 修复了这个问题.

更新到 Visual Studio16.8.0 预览版 1"不会修复此错误.

Updating to Visual Studio "16.8.0 Preview 1" doesn't fix this bug.

解决方法:

  1. false</AndroidEnableAssemblyCompression> 添加到您的 csproj 的发布部分.(我已确认此方法有效)但这可能会导致 apk 大小增加.(更新:似乎没有增加 apk 大小)

  1. add <AndroidEnableAssemblyCompression>false</AndroidEnableAssemblyCompression> to the release section of your csproj. (I've confirmed this one works) But it may result in increased apk sizes. (UPDATE: doesn't appear to increase the apk size)

启用项目链接.(不幸的是,对于某些项目来说,这很难开始工作)

以管理员身份运行 Visual Studio.(我已经确认这适用于预览版安装,但不准备在正常安装中执行此操作)

Run Visual Studio as admin. (I've confirmed this works on the Preview install, but wasn't prepared to do this on normal install)

添加用户修改权限C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\Common7\IDE\ReferenceAssemblies\Microsoft\Framework\MonoAndroid\(这有点像 (3) 但不那么极端.(我已经确认这是有效的))

Add user modify priviligies to C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\Common7\IDE\ReferenceAssemblies\Microsoft\Framework\MonoAndroid\ (This is kind of like (3) but less extreme. (I've confirmed this works))

这篇关于存档 Xamarin Android 应用程序会出现错误 XABLD7019的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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