Xamarin Android设备管理器在创建新设备时发生异常

时间:2018-12-03 14:06:15

标签: java c# android xamarin android-device-manager

在Xamarin Android设备管理器中创建新设备并返回此日志时遇到了一个大问题:

    [18-12-03 13:00:40.26] Executing command: C:\Program Files (x86)\Android\android-sdk\tools\bin\avdmanager.bat "create" "avd" "-n" "my_device" "-k" "system-images;android-27;google_apis_playstore;x86" "--tag" "google_apis_playstore" "--abi" "x86" "-d" "Nexus 5X" "--sdcard" "100M"
[18-12-03 13:00:40.43] C:\Program Files (x86)\Android\android-sdk\tools\bin\avdmanager.bat result: 
StandardError: Exception in thread "main" java.lang.NoSuchMethodError: com.android.prefs.AndroidLocation.getAvdFolder()Ljava/lang/String;
    at com.android.sdklib.tool.AvdManagerCli.init(AvdManagerCli.java:278)
    at com.android.sdklib.tool.AvdManagerCli.run(AvdManagerCli.java:210)
    at com.android.sdklib.tool.AvdManagerCli.main(AvdManagerCli.java:200)
ExitCode: 1
[18-12-03 13:00:40.43] [AvdManager.CreateAvd] avdmanager has returned non-zero exit code: 1
Command: C:\Program Files (x86)\Android\android-sdk\tools\bin\avdmanager.batcreate avd -n my_device -k system-images;android-27;google_apis_playstore;x86 --tag google_apis_playstore --abi x86 -d Nexus 5X --sdcard 100M
Details: Exception in thread "main" java.lang.NoSuchMethodError: com.android.prefs.AndroidLocation.getAvdFolder()Ljava/lang/String;
    at com.android.sdklib.tool.AvdManagerCli.init(AvdManagerCli.java:278)
    at com.android.sdklib.tool.AvdManagerCli.run(AvdManagerCli.java:210)
    at com.android.sdklib.tool.AvdManagerCli.main(AvdManagerCli.java:200)


[18-12-03 13:00:40.44] ERROR: Coudn't create device due to: Xamarin.DeviceManager.Common.LocalizedException: avdmanager has returned non-zero exit code: 1. Please check logs for more information.
   at Xamarin.DeviceManager.Common.AvdManager.<CreateAvd>d__85.MoveNext()
--- 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.DeviceManager.Common.AvdManager.<CreateAvd>d__84.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at Microsoft.VisualStudio.Telemetry.WindowsErrorReporting.WatsonReport.GetClrWatsonExceptionInfo(Exception exceptionObject). 

1 个答案:

答案 0 :(得分:0)

谢谢大家。 当我通过VS安装程序重建Xamarin时,此问题已解决。