在 Visual Studio 16.9.0 Android "deploy to device" 错误 - 命令太长
In Visual Studio 16.9.0 Android "deploy to device" error - Command too long
在我的 xamarin Android 项目中一切正常,直到我更新到 Visual Studio 2019 v16.9.0.
升级后,我能够成功构建项目,但如果我尝试部署或调试到设备或模拟器,我会收到以下错误:
[构建日志的最后部分]
Adding assembly reference for Xamarin.Firebase.Analytics.Impl, recursively...
Adding assembly reference for Xamarin.Firebase.Common, recursively...
Adding assembly reference for Xamarin.Firebase.Iid, recursively...
Adding assembly reference for Xamarin.Firebase.Iid.Interop, recursively...
Adding assembly reference for Xamarin.Firebase.Measurement.Connector, recursively...
Adding assembly reference for Xamarin.Firebase.Messaging, recursively...
Adding assembly reference for Xamarin.Forms.Core, recursively...
Adding assembly reference for Xamarin.Forms.Platform.Android, recursively...
Adding assembly reference for Xamarin.Forms.Platform, recursively...
Adding assembly reference for Xamarin.Forms.Xaml, recursively...
Adding assembly reference for Xamarin.Google.Android.Material, recursively...
Adding assembly reference for Xamarin.Google.AutoValue.Annotations, recursively...
Adding assembly reference for Xamarin.Google.Guava.ListenableFuture, recursively...
Adding assembly reference for Xamarin.GooglePlayServices.Ads.Identifier, recursively...
Adding assembly reference for Xamarin.GooglePlayServices.Analytics, recursively...
Adding assembly reference for Xamarin.GooglePlayServices.Analytics.Impl, recursively...
Adding assembly reference for Xamarin.GooglePlayServices.Base, recursively...
Adding assembly reference for Xamarin.GooglePlayServices.Basement, recursively...
Adding assembly reference for Xamarin.GooglePlayServices.Location, recursively...
Adding assembly reference for Xamarin.GooglePlayServices.Maps, recursively...
Adding assembly reference for Xamarin.GooglePlayServices.Measurement.Api, recursively...
Adding assembly reference for Xamarin.GooglePlayServices.Measurement.Base, recursively...
Adding assembly reference for Xamarin.GooglePlayServices.Places.PlaceReport, recursively...
Adding assembly reference for Xamarin.GooglePlayServices.Stats, recursively...
Adding assembly reference for Xamarin.GooglePlayServices.TagManager.V4.Impl, recursively...
Adding assembly reference for Xamarin.GooglePlayServices.Tasks, recursively...
Skipping target "_CopyConfigFiles" because all output files are up-to-date with respect to the input files.
Skipping target "_ConvertPdbFiles" because all output files are up-to-date with respect to the input files.
Skipping target "_LinkAssembliesNoShrink" because all output files are up-to-date with respect to the input files.
Skipping target "_AndroidXCecilfy" because all output files are up-to-date with respect to the input files.
Skipping target "_GenerateJavaStubs" because all output files are up-to-date with respect to the input files.
Skipping target "_ManifestMerger" because all output files are up-to-date with respect to the input files.
Skipping target "_ConvertCustomView" because all output files are up-to-date with respect to the input files.
Skipping target "_AndroidXJetifyManifest" because all output files are up-to-date with respect to the input files.
Skipping target "_AddStaticResources" because all output files are up-to-date with respect to the input files.
Skipping target "_GeneratePackageManagerJava" because all output files are up-to-date with respect to the input files.
Skipping target "_GenerateAndroidAssetsDir" because all output files are up-to-date with respect to the input files.
Skipping target "_PrepareCreateBaseApk" because all output files are up-to-date with respect to the input files.
Skipping target "_CreateBaseApk" because all output files are up-to-date with respect to the input files.
Skipping target "_CompileJava" because all output files are up-to-date with respect to the input files.
Skipping target "_CompileNativeAssemblySources" because all output files are up-to-date with respect to the input files.
Skipping target "_CreateApplicationSharedLibraries" because all output files are up-to-date with respect to the input files.
Skipping target "_AndroidXJetifyJavaLibraryRules" because all output files are up-to-date with respect to the input files.
Skipping target "_AndroidXJetifyProguardRules" because all output files are up-to-date with respect to the input files.
Skipping target "_CompileToDalvik" because all output files are up-to-date with respect to the input files.
Copying file from "C:\temp0\android\bin\com.caledoslab.runner.apk" to "C:\Caledos\code\Runner\CaledosLab.Runner.Android\bin\Debug\com.caledoslab.runner.apk".
Creating "C:\temp0\android_debug_keystore.flag" because "AlwaysCreate" was specified.
C:\Program Files (x86)\Android\android-sdk\build-tools.0.2\zipalign.exe -p 4 "C:\temp0\android\bin\com.caledoslab.runner.apk" "bin\Debug\com.caledoslab.runner-Signed.apk"
C:\Program Files\Android\Jdk\microsoft_dist_openjdk_1.8.0.25\bin\java.exe -jar "C:\Program Files (x86)\Microsoft Visual Studio19\Enterprise\MSBuild\Xamarin\Android\apksigner.jar" sign --ks "C:\Users
icold\AppData\Local\Xamarin\Mono for Android\debug.keystore" --ks-pass pass:android --ks-key-alias androiddebugkey --key-pass pass:android --min-sdk-version 21 --max-sdk-version 29 C:\Caledos\code\Runner\CaledosLab.Runner.Android\bin\Debug\com.caledoslab.runner-Signed.apk
Signed android package 'bin\Debug\com.caledoslab.runner-Signed.apk'
Using cached value from RegisterTaskObject
Found device: emulator-5554
Command too long
at Mono.AndroidTools.Adb.AdbClient.GetCommandBuffer(String command) in C:\A\s\External\androidtools\Mono.AndroidTools\Adb\AdbClient.cs:line 258
at Mono.AndroidTools.Adb.AdbClient.BeginWriteCommand(String command, AsyncCallback callback, Object state) in C:\A\s\External\androidtools\Mono.AndroidTools\Adb\AdbClient.cs:line 227
at Mono.AndroidTools.Adb.AdbClient.BeginWriteCommandWithStatus(String command, AsyncCallback callback, Object state) in C:\A\s\External\androidtools\Mono.AndroidTools\Adb\AdbClient.cs:line 274
at System.Threading.Tasks.TaskFactory`1.FromAsyncImpl[TArg1](Func`4 beginMethod, Func`2 endFunction, Action`1 endAction, TArg1 arg1, Object state, TaskCreationOptions creationOptions)
at Mono.AndroidTools.Internal.AdbClientTaskExtensions.WriteCommandWithStatusAsync(AdbClient client, String command, TaskCreationOptions options) in C:\A\s\External\androidtools\Mono.AndroidTools\Internal\AdbClientTaskExtensions.cs:line 62
at Mono.AndroidTools.AndroidDevice.<>c__DisplayClass62_0.<RunShellCommand>b__0(Task t) in C:\A\s\External\androidtools\Mono.AndroidTools\AndroidDevice.cs:line 403
at System.Threading.Tasks.ContinuationResultTaskFromTask`1.InnerInvoke()
at System.Threading.Tasks.Task.Execute()
Done building project "CaledosLab.Runner.Android.csproj" -- FAILED.
Build FAILED.
12>Deployment failed to pixel_3a_xl.
========== Build: 11 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========
========== Deploy: 0 succeeded, 1 failed, 0 skipped ==========
有什么想法吗?
谢谢!
TLDR
我可以通过在 Android 项目的选项。
详情
我是 运行 Visual Studio 2019 v16.9。在升级之前我没有遇到任何问题,但是当我上周升级到 16.9 后我开始遇到这个问题。无论目标模拟器/设备如何,都会发生此错误。
在 Visual Studio 的 Build 和 运行 设置中启用诊断构建输出后,我可以在构建输出中看到发生故障快速部署应用程序文件期间。
Visual Studio Build Output
取消选中快速部署后,部署工作正常。我重新打开快速部署并尝试重新部署,但仍然失败。
所以现在我在禁用快速部署的情况下继续开发,到目前为止没有遇到任何问题。
您好,我只是想让您知道我也遇到了这个问题,但是自从升级到 16.9.5 之后,这似乎又对我有用了,并勾选了快速部署:)
在我的 xamarin Android 项目中一切正常,直到我更新到 Visual Studio 2019 v16.9.0.
升级后,我能够成功构建项目,但如果我尝试部署或调试到设备或模拟器,我会收到以下错误:
[构建日志的最后部分]
Adding assembly reference for Xamarin.Firebase.Analytics.Impl, recursively...
Adding assembly reference for Xamarin.Firebase.Common, recursively...
Adding assembly reference for Xamarin.Firebase.Iid, recursively...
Adding assembly reference for Xamarin.Firebase.Iid.Interop, recursively...
Adding assembly reference for Xamarin.Firebase.Measurement.Connector, recursively...
Adding assembly reference for Xamarin.Firebase.Messaging, recursively...
Adding assembly reference for Xamarin.Forms.Core, recursively...
Adding assembly reference for Xamarin.Forms.Platform.Android, recursively...
Adding assembly reference for Xamarin.Forms.Platform, recursively...
Adding assembly reference for Xamarin.Forms.Xaml, recursively...
Adding assembly reference for Xamarin.Google.Android.Material, recursively...
Adding assembly reference for Xamarin.Google.AutoValue.Annotations, recursively...
Adding assembly reference for Xamarin.Google.Guava.ListenableFuture, recursively...
Adding assembly reference for Xamarin.GooglePlayServices.Ads.Identifier, recursively...
Adding assembly reference for Xamarin.GooglePlayServices.Analytics, recursively...
Adding assembly reference for Xamarin.GooglePlayServices.Analytics.Impl, recursively...
Adding assembly reference for Xamarin.GooglePlayServices.Base, recursively...
Adding assembly reference for Xamarin.GooglePlayServices.Basement, recursively...
Adding assembly reference for Xamarin.GooglePlayServices.Location, recursively...
Adding assembly reference for Xamarin.GooglePlayServices.Maps, recursively...
Adding assembly reference for Xamarin.GooglePlayServices.Measurement.Api, recursively...
Adding assembly reference for Xamarin.GooglePlayServices.Measurement.Base, recursively...
Adding assembly reference for Xamarin.GooglePlayServices.Places.PlaceReport, recursively...
Adding assembly reference for Xamarin.GooglePlayServices.Stats, recursively...
Adding assembly reference for Xamarin.GooglePlayServices.TagManager.V4.Impl, recursively...
Adding assembly reference for Xamarin.GooglePlayServices.Tasks, recursively...
Skipping target "_CopyConfigFiles" because all output files are up-to-date with respect to the input files.
Skipping target "_ConvertPdbFiles" because all output files are up-to-date with respect to the input files.
Skipping target "_LinkAssembliesNoShrink" because all output files are up-to-date with respect to the input files.
Skipping target "_AndroidXCecilfy" because all output files are up-to-date with respect to the input files.
Skipping target "_GenerateJavaStubs" because all output files are up-to-date with respect to the input files.
Skipping target "_ManifestMerger" because all output files are up-to-date with respect to the input files.
Skipping target "_ConvertCustomView" because all output files are up-to-date with respect to the input files.
Skipping target "_AndroidXJetifyManifest" because all output files are up-to-date with respect to the input files.
Skipping target "_AddStaticResources" because all output files are up-to-date with respect to the input files.
Skipping target "_GeneratePackageManagerJava" because all output files are up-to-date with respect to the input files.
Skipping target "_GenerateAndroidAssetsDir" because all output files are up-to-date with respect to the input files.
Skipping target "_PrepareCreateBaseApk" because all output files are up-to-date with respect to the input files.
Skipping target "_CreateBaseApk" because all output files are up-to-date with respect to the input files.
Skipping target "_CompileJava" because all output files are up-to-date with respect to the input files.
Skipping target "_CompileNativeAssemblySources" because all output files are up-to-date with respect to the input files.
Skipping target "_CreateApplicationSharedLibraries" because all output files are up-to-date with respect to the input files.
Skipping target "_AndroidXJetifyJavaLibraryRules" because all output files are up-to-date with respect to the input files.
Skipping target "_AndroidXJetifyProguardRules" because all output files are up-to-date with respect to the input files.
Skipping target "_CompileToDalvik" because all output files are up-to-date with respect to the input files.
Copying file from "C:\temp0\android\bin\com.caledoslab.runner.apk" to "C:\Caledos\code\Runner\CaledosLab.Runner.Android\bin\Debug\com.caledoslab.runner.apk".
Creating "C:\temp0\android_debug_keystore.flag" because "AlwaysCreate" was specified.
C:\Program Files (x86)\Android\android-sdk\build-tools.0.2\zipalign.exe -p 4 "C:\temp0\android\bin\com.caledoslab.runner.apk" "bin\Debug\com.caledoslab.runner-Signed.apk"
C:\Program Files\Android\Jdk\microsoft_dist_openjdk_1.8.0.25\bin\java.exe -jar "C:\Program Files (x86)\Microsoft Visual Studio19\Enterprise\MSBuild\Xamarin\Android\apksigner.jar" sign --ks "C:\Users
icold\AppData\Local\Xamarin\Mono for Android\debug.keystore" --ks-pass pass:android --ks-key-alias androiddebugkey --key-pass pass:android --min-sdk-version 21 --max-sdk-version 29 C:\Caledos\code\Runner\CaledosLab.Runner.Android\bin\Debug\com.caledoslab.runner-Signed.apk
Signed android package 'bin\Debug\com.caledoslab.runner-Signed.apk'
Using cached value from RegisterTaskObject
Found device: emulator-5554
Command too long
at Mono.AndroidTools.Adb.AdbClient.GetCommandBuffer(String command) in C:\A\s\External\androidtools\Mono.AndroidTools\Adb\AdbClient.cs:line 258
at Mono.AndroidTools.Adb.AdbClient.BeginWriteCommand(String command, AsyncCallback callback, Object state) in C:\A\s\External\androidtools\Mono.AndroidTools\Adb\AdbClient.cs:line 227
at Mono.AndroidTools.Adb.AdbClient.BeginWriteCommandWithStatus(String command, AsyncCallback callback, Object state) in C:\A\s\External\androidtools\Mono.AndroidTools\Adb\AdbClient.cs:line 274
at System.Threading.Tasks.TaskFactory`1.FromAsyncImpl[TArg1](Func`4 beginMethod, Func`2 endFunction, Action`1 endAction, TArg1 arg1, Object state, TaskCreationOptions creationOptions)
at Mono.AndroidTools.Internal.AdbClientTaskExtensions.WriteCommandWithStatusAsync(AdbClient client, String command, TaskCreationOptions options) in C:\A\s\External\androidtools\Mono.AndroidTools\Internal\AdbClientTaskExtensions.cs:line 62
at Mono.AndroidTools.AndroidDevice.<>c__DisplayClass62_0.<RunShellCommand>b__0(Task t) in C:\A\s\External\androidtools\Mono.AndroidTools\AndroidDevice.cs:line 403
at System.Threading.Tasks.ContinuationResultTaskFromTask`1.InnerInvoke()
at System.Threading.Tasks.Task.Execute()
Done building project "CaledosLab.Runner.Android.csproj" -- FAILED.
Build FAILED.
12>Deployment failed to pixel_3a_xl.
========== Build: 11 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========
========== Deploy: 0 succeeded, 1 failed, 0 skipped ==========
有什么想法吗?
谢谢!
TLDR
我可以通过在 Android 项目的选项。
详情
我是 运行 Visual Studio 2019 v16.9。在升级之前我没有遇到任何问题,但是当我上周升级到 16.9 后我开始遇到这个问题。无论目标模拟器/设备如何,都会发生此错误。
在 Visual Studio 的 Build 和 运行 设置中启用诊断构建输出后,我可以在构建输出中看到发生故障快速部署应用程序文件期间。
Visual Studio Build Output
取消选中快速部署后,部署工作正常。我重新打开快速部署并尝试重新部署,但仍然失败。
所以现在我在禁用快速部署的情况下继续开发,到目前为止没有遇到任何问题。
您好,我只是想让您知道我也遇到了这个问题,但是自从升级到 16.9.5 之后,这似乎又对我有用了,并勾选了快速部署:)