Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Xamarin : No resource found that matches the given names (AppCompat)

I deployed a virtual machine on Azure. I've installed Visual Studio 2015, Xamarin and other mobile development tools. I did the same setup on my local computer to test my apps on my devices from Visual Studio

The only difference is the installation of the Android SDK. On my local machine, I have no image system.

Android DSK Manager

I developed an application on my virtual machine. I have no error during compilation. I uses Android.Support.Design, Android.Support.V4, Android.Support.V7.AppCompat, Android.Support.V7.RecyclerView (latest releases from NuGet) and their MvvmCross implementation.

My Azure Virtual Machine

I wanted to continue the development of the application on my local computer. NuGet the packages are properly restored.

When I build app, I have some errors :

My Local Machine

Error       Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat.Light.DarkActionBar'.  Novatech.Droid  D:\Sources\Novatech\Novatech.Droid\Resources\values\styles.xml
Error       Error retrieving parent for item: No resource found that matches the given name 'Base.Widget.AppCompat.Button'. Novatech.Droid  D:\Sources\Novatech\Novatech.Droid\Resources\values\styles.xml
Error       No resource found that matches the given name: attr 'buttonStyle'.  Novatech.Droid  D:\Sources\Novatech\Novatech.Droid\Resources\values\styles.xml
Error       No resource found that matches the given name: attr 'colorAccent'.  Novatech.Droid  D:\Sources\Novatech\Novatech.Droid\Resources\values\styles.xml
Error       No resource found that matches the given name: attr 'colorPrimary'. Novatech.Droid  D:\Sources\Novatech\Novatech.Droid\Resources\values\styles.xml
Error       No resource found that matches the given name: attr 'colorPrimaryDark'. Novatech.Droid  D:\Sources\Novatech\Novatech.Droid\Resources\values\styles.xml
Error       No resource found that matches the given name: attr 'windowActionBar'.  Novatech.Droid  D:\Sources\Novatech\Novatech.Droid\Resources\values\styles.xml
Error       No resource found that matches the given name: attr 'windowNoTitle'.    Novatech.Droid  D:\Sources\Novatech\Novatech.Droid\Resources\values\styles.xml
Error       No resource found that matches the given name: attr 'windowNoTitle'.    Novatech.Droid  D:\Sources\Novatech\Novatech.Droid\Resources\values\styles.xml

I tried

  • to change 'Theme.AppCompat.Light.DarkActionBar' by '@android:styles/Theme.AppCompat.Light.DarkActionBar' and some others (android/styles)
  • to change target=android-19 to target=android-21 in C:\Program Files (x86)\Android\android-sdk\extras\android\support\v7\appcompat\project.properties

Could someone explain to me what's the problem? I dropped. Same OS, same tools, same SDK, same JDK,

like image 457
Andres Talavera Avatar asked Jun 12 '16 23:06

Andres Talavera


4 Answers

These are steps:

Creating a new app enter image description here

Then right click on "Xamarin.Android.Support.v7.AppCompat", choose "update".

Wait for IDE to finish updating and rebuild the app. enter image description here

like image 184
Nghiem Dao Avatar answered Nov 15 '22 04:11

Nghiem Dao


In my case, "Minimum Android Version" API 21, but "Target Android Version" is "use target framework version (API 23)", however it wasn't working earlier, then I've point both the version as API 21 and all of sudden it is started working as expected.

Later I've changed Minimum Android Version is API 21 and Target Android Version as "use target framework version (API 23)"

like image 30
Boobalan Avatar answered Nov 15 '22 04:11

Boobalan


I had the same problem because ,I was using these item in style.xml

  <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>

but inside color.xml there were no colorAccent defined

<resources>
<color name="primary">#2196F3</color>
<color name="primaryDark">#1976D2</color>
<color name="accent">#FFC107</color>
 <color name="window_background">#F5F5F5</color>
 <color name="splash_background">#3498DB</color>

simply solved by adding

<color name="colorAccent">#3498db</color>
like image 42
TAHA SULTAN TEMURI Avatar answered Nov 15 '22 03:11

TAHA SULTAN TEMURI


Try this.

Navigate to C:\Program Files (x86)\Android\android-sdk\extras\android\support\v7\appcompat.

Open project.properties file.

Change target android to target=android-21.

like image 37
Yksh Avatar answered Nov 15 '22 02:11

Yksh