AvaloniaUI / AvaloniaMauiHybrid

Brings templated controls, pixel perfect rendering, animations, styling and composition to Maui

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Java.Lang.IllegalArgumentException when try the sample

AlleSchonWeg opened this issue · comments

Hi,
i'm going to the readme: https://github.com/AvaloniaUI/AvaloniaMauiHybrid#embedding-maui-controls-inside-of-the-avalonia-app
but when i start the android app i get an exception:

Java.Lang.IllegalArgumentException: 'The style on this component requires your app theme to be Theme.MaterialComponents (or a descendant).'

If i comment out the maui button the project works:

<mauiControls:Button Text="Maui Button" />

AvaloniaApplication1.zip

Some default MAUI controls require MaterialComponents theme to be applied in the app.
You can edit what theme is used in your app:

Change your styles.xml like this:

<style name="MyTheme.NoActionBar" parent="@style/Theme.AppCompat.DayNight.NoActionBar">

to

<style name="MyTheme.NoActionBar" parent="Theme.MaterialComponents.DayNight.NoActionBar">

Updated readme instruction. Thank you for noticing it.