H. Pauwelyn
H. Pauwelyn

Reputation: 14320

No resource found that matches the given names

I'll build a Xamarin application but when I start the build for the Android project, The compiler gives me 9 errors:

9 errors: No resource found that matches the given names:

  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

Notes: The Errors happens in the file styles.xml in the Project.Droid project.

Here you can find the styles.xml file:

<?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>

I've nothing changed in the SmartBox.Droid project but got this errors. Could the problem happen because I've added a MainPage.xaml and a Map.xaml in the SmartBox (Portable) project? I need two pages because I'll navigate between the two pages.

I've searched everywhere on Google and SO but found no solution that helps me. My source code you could find on GitHub (https://github.com/HeinPauwelyn/SmartBox) in the folder Execution → SmartBox

Upvotes: 3

Views: 1805

Answers (2)

Elvis Xia - MSFT
Elvis Xia - MSFT

Reputation: 10841

Please try this solution:

  1. Update your Xamarin to the latest version (both shared project and your platform project).

  2. Then redirect to C:\Users\<username>\AppData\Local\ and rename the Xamarin folder to Xamarin_old.

  3. Reopen your project, and build it. It will take a few minutes until the packages are fully downloaded.

Upvotes: 3

abdul
abdul

Reputation: 1592

Try editing the following lines in your Tabbar.axml and Toolbar.axml inside the Resources/Layout folder. This worked for me.

Tabbar.axml

From:

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

To:

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

Toolbar.axml

From:

android:background="@style/colorPrimary"

To:

android:background="?attr/colorPrimary"

Upvotes: 1

Related Questions