Xamarin 表单应用无法部署到 Android 10 个真实设备

Xamarin forms app fails to deploy to Android 10 real device

描述

我有一个项目在我的诺基亚 android 设备上运行良好。为了更新它的覆盖范围,我将我的设备更新为 android 10。我去了 SDK 管理器并获得了 android v29。

使用我的 AMD PC,仅使用真实设备进行调试。

我将目标框架更改为 v29,Android 10-Q。

我遇到部署问题

重现步骤

  1. 创建一个 Xamarin.针对 Android 9.
  2. 的表单项目
  3. 更新框架和 Nugget 包以更新
  4. 运行

预期行为

成功构建和部署

实际行为

报错

Severity    Code    Description Project File    Line    Suppression State
Error       ADB0010:  Deployment failed
Mono.AndroidTools.InstallFailedException: Unexpected install output: Error: Failed to parse APK file: /data/local/tmp/Mono.Android.Platform.ApiLevel_29.apk
Exception occurred while executing:
java.lang.IllegalArgumentException: Error: Failed to parse APK file: /data/local/tmp/Mono.Android.Platform.ApiLevel_29.apk
    at com.android.server.pm.PackageManagerShellCommand.setParamsSize(PackageManagerShellCommand.java:486)
    at com.android.server.pm.PackageManagerShellCommand.runInstall(PackageManagerShellCommand.java:1075)
    at com.android.server.pm.PackageManagerShellCommand.onCommand(PackageManagerShellCommand.java:169)
    at android.os.ShellCommand.exec(ShellCommand.java:104)
    at com.android.server.pm.PackageManagerService.onShellCommand(PackageManagerService.java:22021)
    at android.os.Binder.shellCommand(Binder.java:881)
    at android.os.Binder.onTransact(Binder.java:765)
    at android.content.pm.IPackageManager$Stub.onTransact(IPackageManager.java:4876)
    at com.android.server.pm.PackageManagerService.onTransact(PackageManagerService.java:4128)
    at android.os.Binder.execTransactInternal(Binder.java:1021)
    at android.os.Binder.execTransact(Binder.java:994)
Caused by: android.content.pm.PackageParser$PackageParserException: Failed to parse /data/local/tmp/Mono.Android.Platform.ApiLevel_29.apk
    at android.content.pm.PackageParser.parseApkLiteInner(PackageParser.java:1597)
    at android.content.pm.PackageParser.parseApkLite(PackageParser.java:1582)
    at com.android.server.pm.PackageManagerShellCommand.setParamsSize(PackageManagerShellCommand.java:479)
    ... 10 more
at Mono.AndroidTools.Internal.AdbOutputParsing.CheckInstallSuccess(String output, String packageName) in E:\A\_work8\s\External\androidtools\Mono.AndroidTools\Internal\AdbOutputParsing.cs:line 345
   at Mono.AndroidTools.AndroidDevice.<>c__DisplayClass95_0.<InstallPackage>b__0(Task`1 t) in E:\A\_work8\s\External\androidtools\Mono.AndroidTools\AndroidDevice.cs:line 753
   at System.Threading.Tasks.ContinuationTaskFromResultTask`1.InnerInvoke()
   at System.Threading.Tasks.Task.Execute()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at AndroidDeviceExtensions.<PushAndInstallPackage>d__11.MoveNext() in E:\A\_work8\s\External\androidtools\Xamarin.AndroidTools\Devices\AndroidDeviceExtensions.cs:line 187
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at AndroidDeviceExtensions.<PushAndInstallPackage>d__11.MoveNext() in E:\A\_work8\s\External\androidtools\Xamarin.AndroidTools\Devices\AndroidDeviceExtensions.cs:line 203
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at AndroidDeviceExtensions.<InstallSharedPlatformAsync>d__24.MoveNext() in E:\A\_work8\s\External\androidtools\Xamarin.AndroidTools\Devices\AndroidDeviceExtensions.cs:line 478
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Xamarin.AndroidTools.AndroidDeploySession.<InstallSharedPlatformAsync>d__110.MoveNext() in E:\A\_work8\s\External\androidtools\Xamarin.AndroidTools\Sessions\AndroidDeploySession.cs:line 355
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Xamarin.AndroidTools.AndroidDeploySession.<EnsureCorrectSharedRuntimes>d__107.MoveNext() in E:\A\_work8\s\External\androidtools\Xamarin.AndroidTools\Sessions\AndroidDeploySession.cs:line 266
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task)
   at Xamarin.AndroidTools.AndroidDeploySession.<RunAsync>d__106.MoveNext() in E:\A\_work8\s\External\androidtools\Xamarin.AndroidTools\Sessions\AndroidDeploySession.cs:line 194
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Xamarin.AndroidTools.AndroidDeploySession.<RunLoggedAsync>d__104.MoveNext() in E:\A\_work8\s\External\androidtools\Xamarin.AndroidTools\Sessions\AndroidDeploySession.cs:line 119          0   

基本信息

截图

Image of error

复制Link

Public git of error

解决方法

仍然卡住 (15-04-2020 14:11 GMT +1)

找到问题的解决方案。好心人帮我解决了。

https://github.com/xamarin/Xamarin.Forms/issues/10707#issuecomment-630271548

我不得不删除在 %localappdata% 生成的所有文件。在我的 windows.

查看 link 了解确切的详细信息