Make sure the class has a public no-arg constructor

I have template

...
    <div id="layout"></div>
    <slot></slot>
...

Java source

@Tag("main-view")
@Theme(Lumo.class)
@HtmlImport("frontend://styles/view/main/MainView.html")
@Viewport(VIEWPORT)
public class MainView extends AbstractView implements RouterLayout, BeforeEnterObserver {
  @Id("layout")
  private Layout layout;
  ...
}

Layout don’t have noargs constructor only Layout(String).
When I try run it I have error “Make sure the class has a public no-arg constructor”

How fix it?

There is an error in mapping of the layout element.

In the template there is a div element

And in the Java code you have a Layout component.
@Id(“layout”)
private Layout layout;

Try with:

@Id("layout")
private Div layout;