I have an app that was working until I added the Xamarin.Forms.Visual.Material packages to it. iOS is OK, but it won't compile on Android.
I'm following this guide: https://devblogs.microsoft.com/xamarin/beautiful-material-design-android-ios/
On the project properties, the Application tab has "Compile using Android version (Target framework): " set to Android 9.0 (Pie). In the Manifest, Minimum Android version is 5.0 (API Level 21 - Lollipop) and Target Android version is Android 9.0 (API Level 28 - Pie).
In the Android project, MainActivity.cs is a FormsAppCompatActivity and has these lines:
global::Xamarin.Forms.Forms.Init(this, savedInstanceState);
global::Xamarin.Forms.FormsMaterial.Init(this, savedInstanceState);
And these are the errors I get at build time. There are six total that reference styles.xml
Error retrieving parent for item: No resource found that matches the given name 'Widget.MaterialComponents.TextInputLayout.FilledBox'.
Error retrieving parent for item: No resource found that matches the given name 'Widget.MaterialComponents.Button.OutlinedButton'.
Error retrieving parent for item: No resource found that matches the given name 'Theme.MaterialComponents.Light.DarkActionBar'.
No resource found that matches the given name: attr 'boxCollapsedPaddingTop'.
Error retrieving parent for item: No resource found that matches the given name 'Widget.MaterialComponents.Button'.
No resource found that matches the given name: attr 'materialButtonStyle'.
The styles.xml file in my project is VERY DIFFERENT than styles.xml in my obj\debug folder. First is what's in my project then is what's in the obj\debug folder. I have deleted the bin and obj folders from the Android project to force them to be regenerated and the result is still the same.
Any suggestions are very welcome. It seems like I've done everything in the guide I linked above.
<?xml version="1.0" encoding="UTF-8"?>
<resources>
<style name="MyTheme" parent="MyTheme.Base">
</style>
<!-- Base theme applied no matter what API -->
<style name="MyTheme.Base" parent="Theme.AppCompat.Light.DarkActionBar">
<!--If you are using revision 22.1 please use just windowNoTitle. Without android:-->
<item name="windowNoTitle">true</item>
<!--We will be using the toolbar so no need to show ActionBar-->
<item name="windowActionBar">false</item>
<!-- Set theme colors from http://www.google.com/design/spec/style/color.html#color-color-palette-->
<!-- colorPrimary is used for the default action bar background -->
<item name="colorPrimary">#3F51B5</item>
<!-- colorPrimaryDark is used for the status bar -->
<item name="colorPrimaryDark">#3F51B5</item>
<!-- colorAccent is used as the default value for colorControlActivated
which is used to tint widgets -->
<item name="colorAccent">#FFA500</item>
<!-- You can also set colorControlNormal, colorControlActivated
colorControlHighlight and colorSwitchThumbNormal. -->
<item name="windowActionModeOverlay">true</item>
<item name="android:datePickerDialogTheme">@style/AppCompatDialogStyle</item>
<item name="android:navigationBarColor">#3F51B5</item>
</style>
<style name="AppCompatDialogStyle" parent="Theme.AppCompat.Light.Dialog">
<item name="colorAccent">#FFA500</item>
</style>
</resources>
obj\debug version:
<?xml version="1.0" encoding="UTF-8"?>
<resources>
<attr name="materialOutlinedButtonStyle" format="reference" />
<attr name="materialSliderStyle" format="reference" />
<attr name="materialProgressBarHorizontalStyle" format="reference" />
<attr name="materialProgressBarCircularStyle" format="reference" />
<!-- Material Base Theme -->
<style name="XamarinFormsMaterialTheme" parent="Theme.MaterialComponents.Light.DarkActionBar">
<item name="materialButtonStyle">@style/XamarinFormsMaterialButton</item>
<item name="materialOutlinedButtonStyle">@style/XamarinFormsMaterialButtonOutlined</item>
<item name="materialSliderStyle">@style/XamarinFormsMaterialSlider</item>
<item name="materialProgressBarHorizontalStyle">@style/XamarinFormsMaterialProgressBarHorizontal</item>
<item name="materialProgressBarCircularStyle">@style/XamarinFormsMaterialProgressBarCircular</item>
</style>
<!-- Material Sliders -->
<style name="XamarinFormsMaterialSlider" parent="Widget.AppCompat.SeekBar" />
<!-- Material Progress Bars -->
<style name="XamarinFormsMaterialProgressBarHorizontal" parent="Widget.AppCompat.ProgressBar.Horizontal">
<item name="android:indeterminateOnly">false</item>
<item name="android:progressDrawable">@drawable/materialprogressbar</item>
</style>
<style name="XamarinFormsMaterialProgressBarCircular" parent="Widget.AppCompat.ProgressBar" />
<!-- Material Buttons (All Styles) -->
<style name="XamarinFormsMaterialButton" parent="Widget.MaterialComponents.Button">
<item name="android:insetTop">0dp</item>
<item name="android:insetBottom">0dp</item>
<item name="android:minHeight">36dp</item>
<item name="android:paddingTop">8dp</item>
<item name="android:paddingBottom">8dp</item>
</style>
<style name="XamarinFormsMaterialButtonOutlined" parent="Widget.MaterialComponents.Button.OutlinedButton">
<item name="android:insetTop">0dp</item>
<item name="android:insetBottom">0dp</item>
<item name="android:minHeight">36dp</item>
<item name="android:paddingTop">8dp</item>
<item name="android:paddingBottom">8dp</item>
</style>
<style name="XamarinFormsMaterialEntryFilled" parent="Widget.MaterialComponents.TextInputLayout.FilledBox">
<item name="boxCollapsedPaddingTop">8dp</item>
</style>
</resources>