繁体   English   中英

构建新的Xamarin.Forms项目失败

[英]Building a new Xamarin.Forms project fails

我正在尝试使用Xamarin Studio(6.1.1内部版本15。macOS v10.12)创建一个新的Xamarin.Forms项目。 我有3个项目的解决方案。 一台是共享的,一台是iOS的,一台是Android的。 除了Android之外,其他所有东西都构建。 尝试编译资源(特别是样式文件)时,它失败。

出现以下错误:

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。 它会自动添加所需的支持包。 但是错误仍然发生。

我通过从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