简体   繁体   English

构建新的Xamarin.Forms项目失败

[英]Building a new Xamarin.Forms project fails

I'm trying to create a new Xamarin.Forms project using Xamarin Studio (6.1.1 build 15. macOS v10.12). 我正在尝试使用Xamarin Studio(6.1.1内部版本15。macOS v10.12)创建一个新的Xamarin.Forms项目。 I get a solution with 3 projects. 我有3个项目的解决方案。 One shared, one for iOS and one for Android. 一台是共享的,一台是iOS的,一台是Android的。 Everything build except the Android one. 除了Android之外,其他所有东西都构建。 It fails when trying to compile the resources, specifically the styles file. 尝试编译资源(特别是样式文件)时,它失败。

The following errors appear: 出现以下错误:

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'.

I tried to remove all Android support related libraries and Xamarin.Forms itself and add them again with NuGet. 我试图删除所有与Android支持相关的库和Xamarin.Forms本身,然后使用NuGet再次添加它们。 But that didn't help. 但这没有帮助。 The Xamarin.Forms version I'm using is 2.3.2.127. 我正在使用的Xamarin.Forms版本是2.3.2.127。

Maybe someone can help me out here? 也许有人可以在这里帮助我?

Edit: This is the file where the errors occurs. 编辑:这是发生错误的文件。 I didn't change anything. 我什么都没改变。 This is what Xamarin generated. 这就是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>

I also removed all packages and re-added Xamarin.Forms. 我还删除了所有软件包,并重新添加了Xamarin.Forms。 It automatically adds the required support packages. 它会自动添加所需的支持包。 But the error still occurs. 但是错误仍然发生。

我通过从https://developer.xamarin.com/guides/android/troubleshooting/resolving-library-installation-errors/中下载android_m2repository_r29.zip存储库(使用相同的说明)来解决此问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM