簡體   English   中英

找不到與給定名稱匹配的資源

[英]No resource found that matches the given names

我將構建一個Xamarin應用程序但是當我開始構建Android項目時,編譯器給出了9個錯誤:

9個錯誤:找不到與給定名稱匹配的資源:

  1. attr windowNoTitle
  2. attr colorPrimaryDark
  3. attr windowActionBar
  4. attr windowActionModeOverlay
  5. attr colorAccent
  6. attr colorPrimary
  7. attr colorAccent
  8. Theme.AppCompat.Light.Dialog
  9. Theme.AppCompat.Light.DarkActionBar

注意:錯誤發生在Project.Droid項目的文件styles.xml中。

在這里你可以找到styles.xml文件:

<?xml version="1.0" encoding="utf-8" ?>
<resources>

  <style name="MainTheme" parent="MainTheme.Base">
  </style>

  <style name="MainTheme.Base" parent="Theme.AppCompat.Light.DarkActionBar">
    <item name="windowNoTitle">true</item>
    <item name="windowActionBar">false</item>
    <item name="colorPrimary">#2196F3</item>
    <item name="colorPrimaryDark">#1976D2</item>
    <item name="colorAccent">#FF4081</item>
    <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>

我在SmartBox.Droid項目中沒有任何改變,但是出現了這個錯誤。 問題是否發生是因為我在SmartBox (Portable)項目中添加了MainPage.xamlMap.xaml 我需要兩頁,因為我將在兩頁之間導航。

我在谷歌和搜索引擎優化的各個地方都進行了搜索,但沒有找到能幫助我的解 我可以在GitHub( https://github.com/HeinPauwelyn/SmartBox )的文件夾Execution→SmartBox中找到我的源代碼

請試試這個解決方案:

  1. 將您的Xamarin更新到最新版本(共享項目和您的平台項目)。

  2. 然后重定向到C:\\Users\\<username>\\AppData\\Local\\並將Xamarin文件夾重命名為Xamarin_old

  3. 重新打開您的項目,然后構建它。 完全下載軟件包需要幾分鍾。

嘗試在Resources / Layout文件夾中的Tabbar.axmlToolbar.axml編輯以下行。 這對我有用。

Tabbar.axml

從:

android:background="@style/colorPrimary"
app:tabIndicatorColor="@color/white"

至:

android:background="?attr/colorPrimary"
app:tabIndicatorColor="@android:color/white"

Toolbar.axml

從:

android:background="@style/colorPrimary"

至:

android:background="?attr/colorPrimary"

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM