Я пытаюсь создать новый проект Xamarin.Forms с использованием Xamarin Studio (6.1.1 build 15. macOS v10.12). Я получаю решение с тремя проектами. Один общий, один для iOS и один для Android. Все построено, кроме Android. Это не удается при попытке скомпилировать ресурсы, в частности файл стилей. появляютсяНе удалось создать новый проект Xamarin.Forms
следующие ошибки:
Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat.Light.DarkActionBar'.
No resource found that matches the given name: attr 'colorAccent'.
No resource found that matches the given name: attr 'colorPrimary'.
No resource found that matches the given name: attr 'colorPrimaryDark'.
No resource found that matches the given name: attr 'windowActionBar'.
No resource found that matches the given name: attr 'windowActionModeOverlay'.
No resource found that matches the given name: attr 'windowNoTitle'.
Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat.Light.Dialog'.
No resource found that matches the given name: attr 'colorAccent'.
Я попытался удалить все Android библиотеки и Xamarin.Forms самой опоры, связанные и добавить их снова с NuGet. Но это не помогло. Версия Xamarin.Forms, которую я использую, - 2.3.2.127.
Может быть, кто-то может помочь мне здесь?
Редактировать: Это файл, в котором происходят ошибки. Я ничего не изменил. Это то, что генерировал Xamarin.
<?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">#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>
Я также удалил все пакеты и повторно добавил Xamarin.Forms. Он автоматически добавляет необходимые пакеты поддержки. Но ошибка все же происходит.
Как вы определяете эти ресурсы в своем 'styles.xml'? Можете ли вы разместить соответствующий код, показывающий эти предметы? Большинство этих ошибок исходят из https://www.nuget.org/packages/Xamarin.Android.Support.v7.AppCompat/ и https://www.nuget.org/packages/Xamarin.Android.Support.Design/ пакеты. Убедитесь, что они определены в файле 'Resources.designer.cs'. –
Вам нужны библиотеки поддержки, такие как Xamarin.Forms. Может показаться глупым, но вы попробовали перестроить все? Это стандартные ресурсы для Android, и иногда их не тянет в первый раз, поэтому вам нужно перестроить все. – JimBobBennett