我使用的是 VS Community 2015,更新 3。我通过 VS 安装程序安装了 Xamarin v4.2,然后通过 Xamarin 安装程序更新到 4.2.1.60。
我创建了一个新的跨平台项目:空白应用程序(Xamarins.Forms Portable)
。我将 Droid 项目设置为 Startup Project,然后右键单击 BlankApp1.Droid 尝试编译 Android 项目。
我收到以下编译错误:(错误位于文件 styles.xml
中)
No resource found that matches the given name: attr 'windowActionBar'.
No resource found that matches the given name: attr 'windowNoTitle'.
No resource found that matches the given name: attr 'colorPrimaryDark'.
No resource found that matches the given name: attr 'colorPrimary'.
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'.
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'.
No resource found that matches the given name: attr 'windowActionModeOverlay'.
样式.xml:
<?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>
包配置:
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Xamarin.Android.Support.Animated.Vector.Drawable" version="23.3.0" targetFramework="monoandroid60" />
<package id="Xamarin.Android.Support.Design" version="23.3.0" targetFramework="monoandroid60" />
<package id="Xamarin.Android.Support.v4" version="23.3.0" targetFramework="monoandroid60" />
<package id="Xamarin.Android.Support.v7.AppCompat" version="23.3.0" targetFramework="monoandroid60" />
<package id="Xamarin.Android.Support.v7.CardView" version="23.3.0" targetFramework="monoandroid60" />
<package id="Xamarin.Android.Support.v7.MediaRouter" version="23.3.0" targetFramework="monoandroid60" />
<package id="Xamarin.Android.Support.v7.RecyclerView" version="23.3.0" targetFramework="monoandroid60" />
<package id="Xamarin.Android.Support.Vector.Drawable" version="23.3.0" targetFramework="monoandroid60" />
<package id="Xamarin.Forms" version="2.3.2.127" targetFramework="monoandroid60" />
</packages>
该项目设置为使用最新的 Android 版本 = 6.0 进行编译。
我还将 Xamarin.Forms Nuget 包从 2.2.0.45 更新到 2.3.2.127。我得到相同的错误列表(尽管奇怪的是,错误的顺序不同......)
对于问题是什么以及如何解决有什么想法吗?
最佳答案
导航至:
C:\Users\username\AppData\Local\Xamarin\zips
找到此 zip 文件:
2A3A8A6D6826EF6CC653030E7D695C41.zip
现在删除此文件,然后返回 Visual Studio 并重建解决方案。根据您的连接速度,需要一些时间才能完全下载该文件,大约 200mb。
关于xamarin - "No resource found..."尝试编译空白的跨平台 Xamarin 应用程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40672135/