Xamarin.Forms Previewer - An android application project must reference a project containing this xaml file in order to render in the previewer

后端 未结 6 1166
孤城傲影
孤城傲影 2021-02-20 01:53

I\'m getting the following error when trying to preview XAML documents via the Xamarin.Forms Previewer while in Visual Studio.

An Android Application proj

相关标签:
6条回答
  • 2021-02-20 01:58

    This problem can occur for a number of issues. Main problem is that for some reason Android's project can't build or be run inside Xamarin.

    For me, the issue was that the latest JDK was not installed. My JRE was, but not JDK. Once I reinstalled JDK and restarted Visual Studio. All was well.

    0 讨论(0)
  • 2021-02-20 02:00

    just check if your project structure fits the file system/ folder structure.

    rename the folders to fit the project structure helped in my case.

    like if your Android Shared Project name is : "AppBla.Shared" and your folder name is "App4" or something.

    0 讨论(0)
  • 2021-02-20 02:04

    Check your android project and make sure the dll of your PCL/.net standard project is reference. In my own case, its referenced but shows a yellow color. I deleted the reference and re-reference by right clicking on the android project>projects>solution>select the PCL/.net standard project > ok

    0 讨论(0)
  • 2021-02-20 02:05

    This solved my problem.

    1. Right Click on the project
    2. Click on Manage NuGet Packages
    3. Click on the Update Tab
    4. Select Xamarin.Forms and hit update

    Update Xamarin.Forms NuGet Package

    0 讨论(0)
  • 2021-02-20 02:13

    i think my solution is help this problem.

    it has two problem, one is the solution path, the other one is dll reference.

    I'll explain it with the example program Todo(example forum).

    first, you have to clean your solution path like below png

    png

    secondly, you have to clean your all project (Todo, Todo.android, Todo.ios...)

    then, you'll be able to see warning at Todo.dll(in Todo.android referense)

    then, you have to delete Todo.dll

    and build your Todo project then will create new dll

    finally, Add it('new dll') to Todo.anroid project reference and include a Todo project in your Todo.android project(Todo.android reference add-> project -> check Todo).

    check Todo

    and restart visual studio

    result

    0 讨论(0)
  • 2021-02-20 02:13

    None of the suggestions here worked for me. Upgrading to VS 2019 solved it.

    0 讨论(0)
提交回复
热议问题