Reputation: 137
I have been trying to update a Xamarin project to later versions of Xamarin using Nuget and it keeps failing with missing components, which Nuget cannot install because other compjnents are missing....
So I thought as I need to do a major upgrade anyway, I'll start with a new, latest Xamarin project, and migrate the code across and change it.
Except I am getting errors with a completely empty and new Xamarin project and I am at a loss as to how to fix them.
I have repaired VS 2017 a couple of times with no luck.
The errors are with the generated Android styles.xml file. This is identical to the one in the old project, but that isn't giving errors.
<?xml version="1.0" encoding="utf-8" ?>
<resources>
<style name="MainTheme" parent="MainTheme.Base">
</style>
<!-- Base theme applied no matter what API -->
<style name="MainTheme.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">#2196F3</item>
<!-- colorPrimaryDark is used for the status bar -->
<item name="colorPrimaryDark">#1976D2</item>
<!-- colorAccent is used as the default value for colorControlActivated
which is used to tint widgets -->
<item name="colorAccent">#FF4081</item>
<!-- You can also set colorControlNormal, colorControlActivated
colorControlHighlight and colorSwitchThumbNormal. -->
<item name="windowActionModeOverlay">true</item>
<item name="android:datePickerDialogTheme">@style/AppCompatDialogStyle</item>
</style>
<style name="AppCompatDialogStyle" parent="Theme.AppCompat.Light.Dialog">
<item name="colorAccent">#FF4081</item>
</style>
</resources>
And are as follows - only the first 3, all have errors:
3: error: Error: No resource found that matches the given name: attr 'colorAccent'.
1: error: Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat.Light.DarkActionBar'.
2: error: Error: No resource found that matches the given name: attr 'colorAccent'.
Upvotes: 0
Views: 114
Reputation: 137
For anyone who has this problem, I found the following article:
https://learn.microsoft.com/en-gb/nuget/Consume-Packages/Package-restore-troubleshooting
Somehow these settings were unchecked in Visual Studio Options, which meant Nuget restore wasn't happening.
With Nuget restore turned on it auto downloaded the missing components and the errors went away.
Upvotes: 1