1

我在 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). 
4

1 回答 1

1

谢谢大家。当我通过 VS 安装程序重建 Xamarin 时,这个问题得到了解决。

于 2018-12-04T07:05:25.447 回答