visual studio for mac - 无法预览android

时间:2018-05-10 09:03:38

标签: xamarin.forms visual-studio-mac

我已经安装了Visual Studio for Mac并启动了一个新的解决方案。我应该能够在Android屏幕上预览(见附件),但无法让它工作。有任何想法吗? screenshot

以下是详细信息: 这是Android Preview中的错误消息:System.NullReferenceException:未将对象引用设置为对象的实例   在/Users/vsts/agent/2.133.3/work/1/s/Xamarin.Designer.Android/Xamarin.AndroidDesigner/Xamarin中的Xamarin.AndroidDesigner.CodeInteractions.CodeModelBridge.b__31_0(Microsoft.CodeAnalysis.AttributeData a)[0x00000] .AndroidDesigner.CodeInteractions / CodeModelBridge.cs:403   at System.Linq.ImmutableArrayExtensions.Any [T](System.Collections.Immutable.ImmutableArray 1[T] immutableArray, System.Func 2 [T,TResult]谓词)[0x00025] in&lt; 36486b016d234fca8cd67892bf29c7b5&gt ;:0   在/Users/vsts/agent/2.133.3/work/1/s/Xamarin.Designer.Android/Xamarin.AndroidDesigner/Xamarin中的Xamarin.AndroidDesigner.CodeInteractions.CodeModelBridge.IsActivityType(Microsoft.CodeAnalysis.INamedTypeSymbol类型)[0x00008] .AndroidDesigner.CodeInteractions / CodeModelBridge.cs:403   在/Users/vsts/agent/2.133.3/work/1/s/Xamarin.Designer.Android/Xamarin.AndroidDesigner/Xamarin中的Xamarin.AndroidDesigner.CodeInteractions.CodeModelBridge.GetAndroidEntityForType(Microsoft.CodeAnalysis.INamedTypeSymbol类型)[0x00001] .AndroidDesigner.CodeInteractions / CodeModelBridge.cs:120   在/Users/vsts/agent/2.133.3/work/1/s/Xamarin.Designer.Android/Xamarin.AndroidDesigner/Xamarin中的Xamarin.AndroidDesigner.CodeInteractions.CodeModelBridge.b__26_2(Microsoft.CodeAnalysis.INamedTypeSymbol t)[0x00000] .AndroidDesigner.CodeInteractions / CodeModelBridge.cs:311   在System.Linq.Utilities +&lt;&gt; c__DisplayClass1_0 1[TSource].<CombinePredicates>b__0 (TSource x) [0x00000] in /Users/builder/jenkins/workspace/build-package-osx-mono/2018-02/external/bockbuild/builds/mono-x64/external/corefx/src/System.Linq/src/System/Linq/Utilities.cs:58 at System.Linq.Enumerable+WhereSelectEnumerableIterator 2 [TSource,TResult] .ToList()[0x0001b]在/ Users / builder / jenkins / workspace / build-package-osx-mono / 2018- 02 /外部/ bockbuild /建立/单X64 /外部/ corefx / SRC / System.Linq的/ SRC /系统/ LINQ的/ Where.cs:737   at System.Linq.Enumerable.ToList [TSource](System.Collections.Generic.IEnumerable 1[T] source) [0x0000e] in /Users/builder/jenkins/workspace/build-package-osx-mono/2018-02/external/bockbuild/builds/mono-x64/external/corefx/src/System.Linq/src/System/Linq/ToCollection.cs:30 at Xamarin.AndroidDesigner.CodeInteractions.CodeModelBridge+<GetCustomComponentsInProject>d__26.MoveNext () [0x00147] in /Users/vsts/agent/2.133.3/work/1/s/Xamarin.Designer.Android/Xamarin.AndroidDesigner/Xamarin.AndroidDesigner.CodeInteractions/CodeModelBridge.cs:308 --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x00037] in /Users/builder/jenkins/workspace/build-package-osx-mono/2018-02/external/bockbuild/builds/mono-x64/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:187 at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in /Users/builder/jenkins/workspace/build-package-osx-mono/2018-02/external/bockbuild/builds/mono-x64/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:156 at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in /Users/builder/jenkins/workspace/build-package-osx-mono/2018-02/external/bockbuild/builds/mono-x64/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:128 at System.Runtime.CompilerServices.TaskAwaiter 1 [TResult] .GetResult()[0x00000]在/ Users / builder / jenkins / workspace / build-package-osx中 - 单/ 2018-02 /外部/ bockbuild /建立/单X64 / MCS /类/ referencesource / mscorlib程序/系统/运行/ compilerservices / TaskAwaiter.cs:357   在Xamarin.AndroidDesigner.DesignerProject + d__101.MoveNext()[0x00025] /Users/vsts/agent/2.133.3/work/1/s/Xamarin.Designer.Android/Xamarin.AndroidDesigner/Xamarin.AndroidDesigner/DesignerProject.cs :300 ---从抛出异常的先前位置开始的堆栈跟踪结束---   在/ Users / builder / jenkins / workspace / build-package-osx-mono / 2018-02 / external / bockbuild / builds中的System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(System.Threading.Tasks.Task任务)[0x00037] /mono-x64/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:187   在/ Users / builder / jenkins / workspace / build-package-osx-mono / 2018-02 / external / bockbuild / builds中的System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(System.Threading.Tasks.Task任务)[0x00028] /mono-x64/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:156   在/ Users / builder / jenkins / workspace / build-package-osx-mono / 2018-02 / external / bockbuild / builds中的System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(System.Threading.Tasks.Task任务)[0x00008] /mono-x64/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:128   在/ Users / builder / jenkins / workspace / build-package-osx-mono / 2018-02 / external / bockbuild / builds / mono-x64 / mcs / class中的System.Runtime.CompilerServices.TaskAwaiter.GetResult()[0x00000] /referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:113   在Xamarin.AndroidDesigner.DesignerProject + d__102.MoveNext()[0x00020] /Users/vsts/agent/2.133.3/work/1/s/Xamarin.Designer.Android/Xamarin.AndroidDesigner/Xamarin.AndroidDesigner/DesignerProject.cs :307 ---从抛出异常的先前位置开始的堆栈跟踪结束---   在/ Users / builder / jenkins / workspace / build-package-osx-mono / 2018-02 / external / bockbuild / builds中的System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(System.Threading.Tasks.Task任务)[0x00037] /mono-x64/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:187   在/ Users / builder / jenkins / workspace / build-package-osx-mono / 2018-02 / external / bockbuild / builds中的System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(System.Threading.Tasks.Task任务)[0x00028] /mono-x64/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:156   在/ Users / builder / jenkins / workspace / build-package-osx-mono / 2018-02 / external / bockbuild / builds中的System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(System.Threading.Tasks.Task任务)[0x00008] /mono-x64/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:128   在/ Users / builder / jenkins / workspace / build-package-osx-mono / 2018-02 / external / bockbuild / builds / mono-x64 / mcs / class中的System.Runtime.CompilerServices.TaskAwaiter.GetResult()[0x00000] /referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:113   在Xamarin.AndroidDesigner.DesignerProject + d__54.MoveNext()[0x0038a] /Users/vsts/agent/2.133.3/work/1/s/Xamarin.Designer.Android/Xamarin.AndroidDesigner/Xamarin.AndroidDesigner/DesignerProject.cs :141 ---从抛出异常的先前位置开始的堆栈跟踪结束---   在/ Users / builder / jenkins / workspace / build-package-osx-mono / 2018-02 / external / bockbuild / builds中的System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(System.Threading.Tasks.Task任务)[0x00037] /mono-x64/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:187   在/ Users / builder / jenkins / workspace / build-package-osx-mono / 2018-02 / external / bockbuild / builds中的System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(System.Threading.Tasks.Task任务)[0x00028] /mono-x64/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:156   在/ Users / builder / jenkins / workspace / build-package-osx-mono / 2018-02 / external / bockbuild / builds中的System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(System.Threading.Tasks.Task任务)[0x00008] /mono-x64/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:128   在/ Users / builder / jenkins / workspace / build-package-osx-mono / 2018-02 / external / bockbuild / builds / mono-x64 / mcs / class中的System.Runtime.CompilerServices.TaskAwaiter.GetResult()[0x00000] /referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:113   在Xamarin.AndroidDesigner.AndroidDesignerService + d__57.MoveNext()[0x0005a] /Users/vsts/agent/2.133.3/work/1/s/Xamarin.Designer.Android/Xamarin.AndroidDesigner/Xamarin.AndroidDesigner/AndroidDesignerService.cs :464 ---从抛出异常的先前位置开始的堆栈跟踪结束---   在/ Users / builder / jenkins / workspace / build-package-osx-mono / 2018-02 / external / bockbuild / builds中的System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(System.Threading.Tasks.Task任务)[0x00037] /mono-x64/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:187   在/ Users / builder / jenkins / workspace / build-package-osx-mono / 2018-02 / external / bockbuild / builds中的System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(System.Threading.Tasks.Task任务)[0x00028] /mono-x64/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:156   在/ Users / builder / jenkins / workspace / build-package-osx-mono / 2018-02 / external / bockbuild / builds中的System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(System.Threading.Tasks.Task任务)[0x00008] /mono-x64/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:128   at System.Runtime.CompilerServices.TaskAwaiter 1[TResult].GetResult () [0x00000] in /Users/builder/jenkins/workspace/build-package-osx-mono/2018-02/external/bockbuild/builds/mono-x64/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:357 at Xamarin.Designer.Forms.XamarinStudioXamlPreviewerView+<InitializeAndroidDesignerProject>d__65.MoveNext () [0x00122] in /Users/vsts/agent/2.133.3/work/1/s/Xamarin.Designer.Forms/Xamarin.FormsPreviewer.MonoDevelop/Xamarin.Designer.Forms/XamarinStudioXamlPreviewerView.cs:542 --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x00037] in /Users/builder/jenkins/workspace/build-package-osx-mono/2018-02/external/bockbuild/builds/mono-x64/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:187 at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in /Users/builder/jenkins/workspace/build-package-osx-mono/2018-02/external/bockbuild/builds/mono-x64/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:156 at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in /Users/builder/jenkins/workspace/build-package-osx-mono/2018-02/external/bockbuild/builds/mono-x64/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:128 at System.Runtime.CompilerServices.TaskAwaiter 1 [TResult] .GetResult()[0x00000]在/ Users / builder / jenkins / workspace / build-package-osx-mono / 2018-02 / external / bockbuild /建立/单X64 / MCS /类/ referencesource / mscorlib程序/系统/运行/ compilerservices / TaskAwaiter.cs:357   在Xamarin.Designer.Forms.Preview.AndroidXamlRenderer + d__15.MoveNext()[0x00078] /Users/vsts/agent/2.133.3/work/1/s/Xamarin.Designer.Forms/Xamarin.Designer.Forms.Preview /Android/AndroidXamlRenderer.cs:78 ---从抛出异常的先前位置开始的堆栈跟踪结束---   在/ Users / builder / jenkins / workspace / build-package-osx-mono / 2018-02 / external / bockbuild / builds中的System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(System.Threading.Tasks.Task任务)[0x00037] /mono-x64/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:187   在/ Users / builder / jenkins / workspace / build-package-osx-mono / 2018-02 / external / bockbuild / builds中的System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(System.Threading.Tasks.Task任务)[0x00028] /mono-x64/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:156   在/ Users / builder / jenkins / workspace / build-package-osx-mono / 2018-02 / external / bockbuild / builds中的System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(System.Threading.Tasks.Task任务)[0x00008] /mono-x64/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:128   在/ Users / builder / jenkins / workspace / build-package-osx-mono / 2018-02 / external / bockbuild / builds / mono-x64 / mcs / class中的System.Runtime.CompilerServices.TaskAwaiter.GetResult()[0x00000] /referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:113   在Xamarin.Designer.Forms.Preview.AndroidXamlRenderer + d__17.MoveNext()[0x0004b] in /Users/vsts/agent/2.133.3/work/1/s/Xamarin.Designer.Forms/Xamarin.Designer.Forms.Preview /Android/AndroidXamlRenderer.cs:122 ---从抛出异常的先前位置开始的堆栈跟踪结束---   在/ Users / builder / jenkins / workspace / build-package-osx-mono / 2018-02 / external / bockbuild / builds中的System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(System.Threading.Tasks.Task任务)[0x00037] /mono-x64/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:187   在/ Users / builder / jenkins / workspace / build-package-osx-mono / 2018-02 / external / bockbuild / builds中的System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(System.Threading.Tasks.Task任务)[0x00028] /mono-x64/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:156   在/ Users / builder / jenkins / workspace / build-package-osx-mono / 2018-02 / external / bockbuild / builds中的System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(System.Threading.Tasks.Task任务)[0x00008] /mono-x64/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:128   在/ Users / builder / jenkins / workspace / build-package-osx-mono / 2018-02 / external / bockbuild / builds / mono-中的System.Runtime.CompilerServices.TaskAwaiter`1 [TResult] .GetResult()[0x00000] 64 / MCS /类/ referencesource / mscorlib程序/系统/运行/ compilerservices / TaskAwaiter.cs:357   在/Users/vsts/agent/2.133.3/work/1/s/Xamarin.Designer.Forms/Xamarin.Designer.Forms.Preview中的Xamarin.Designer.Forms.Preview.AndroidXamlRenderer + d__18.MoveNext()[0x000a0] /Android/AndroidXamlRenderer.cs:197

1 个答案:

答案 0 :(得分:0)

原来问题是我的Java版本是10,我需要版本8.然后在VS中打开首选项并告诉它Java的新版本在哪里。然后,我允许我更新SDK,更新VS(重启),一切正常。

http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html