Android preview in Visual Studio for Mac

Hi guys,
I should use the preview for an Android device but I receive this error.

Creating class loader with 48 projects

Creating LibraryClassLoader in shadow copy path /var/folders/2g/dsdv9ryn5x7c39myn775z8pr0000gn/T/AndroidDesignerJars3034191262715436707
Setting id 2 on newly created ClassLoader

Trying to load class md5e940e1e778de0f856e343395a2f338c5.XFPageRendererView

mono.android.DesignerException: java.lang.NullPointerException
at mono.android.DesignerException.fromThrowable(DesignerException.java:46)
at mono.android.DesignerSession.checkRenderResultForError(DesignerSession.java:187)
at mono.android.DesignerSession.load(DesignerSession.java:239)
at mono.android.DesignerSession.processMessage(DesignerSession.java:702)
at mono.android.MessageListener.executeMessage(MessageListener.java:88)
at mono.android.MessageListener$Runner.run(MessageListener.java:44)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.NullPointerException
at android.os.storage.StorageManager.getVolumeList(StorageManager.java:922)
at android.os.Environment$UserEnvironment.getExternalDirs(Environment.java:87)
at android.os.Environment$UserEnvironment.buildExternalStoragePublicDirs(Environment.java:107)
at android.os.Environment.getExternalStoragePublicDirectory(Environment.java:588)
at md5b60ffeb829f638581ab2bb9b1a7f4f3f.PageRenderer.n_onAttachedToWindow(Native Method)
at md5b60ffeb829f638581ab2bb9b1a7f4f3f.PageRenderer.onAttachedToWindow(PageRenderer.java:55)
at android.view.View.dispatchAttachedToWindow(View.java:15395)
at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:2953)
at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:2960)
at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:2960)
at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:2960)
at android.view.AttachInfo_Accessor.setAttachInfo(AttachInfo_Accessor.java:42)
at com.android.layoutlib.bridge.impl.RenderSessionImpl.inflate(RenderSessionImpl.java:333)
at com.android.layoutlib.bridge.Bridge.createSession(Bridge.java:429)
at com.android.ide.common.rendering.LayoutLibrary.createSession(LayoutLibrary.java:368)
at mono.android.DesignerSession.load(DesignerSession.java:233)
... 4 more

Answers

  • JGoldbergerJGoldberger USXamarin Team, University Xamurai

    @EnricoRossini

    Can you clarify? Is this a Xamarin Forms project and are you trying to use the Xamarin Forms previewer to preview a Xamarin Forms XAML page?

    If so, did you make sure your solution is built before trying to preview? Do you have the latest Android SDKs installed?

  • EnricoRossiniEnricoRossini USMember ✭✭✭

    Thanks @JGoldberger. It is a Xamarin Forms project and I'm trying to preview a Xamarin Forms XAML page. The solution is build correctly and I've installed all Android SDK. The app is installed and working correctly on about 30 devices.

  • JGoldbergerJGoldberger USXamarin Team, University Xamurai

    @EnricoRossini

    What is your target framework setting? Look in Project Options->Build->General page. Do you get the same issue if it is set to the latest installed SDK (which should be 7.1 Nougat if you have all the SDKs installed as you said?

  • EnricoRossiniEnricoRossini USMember ✭✭✭

    I have this settings

  • JGoldbergerJGoldberger USXamarin Team, University Xamurai

    @EnricoRossini

    Can you try installing the Android 7.1 SDK using the Android SDK Manager?

Sign In or Register to comment.