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

15

17

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,

Quire answered 12/6, 2016 at 23:50 Comment(1)
Please clean and rebuild your project,Feuar
Q
0

I switched from Xamarin Components to NuGet packages and it works now. MvvmCross installed the latest versions of packages Nuget (23.3.0) for its dependencies (MvvmCross.Droid.Support.V4, MvvmCross.Droid.Support.V7.AppCompat, MvvmCross.Droid.Support.V7.Preference ...). and components used earlier.

I also had to copy the "C:\Users\andres\AppData\Local\Xamarin" folder from my virtual machine.

In Visual Studio, I had no notification about an update available for the components.

Quire answered 15/6, 2016 at 9:33 Comment(0)
H
13

I got the same problem with Xamarin Studio on Mac. What I did to solve the problem is updating the NuGet Package Xamarin.Android.Support.v7.AppCompat. I think you can use the same approach to fix your issue on Visual Studio, too.

Take a look
enter image description here

Haiku answered 14/6, 2016 at 11:1 Comment(4)
I have the latest version (23.3.0)Quire
I had to remove the entire support libraries and add them againStefansson
Sadly, it didn't work as it gives me this message: Updating 'Xamarin.Android.Support.v7.AppCompat 23.3.0' to 'Xamarin.Android.Support.v7.AppCompat 23.4.0.1' failed. Unable to find a version of 'Xamarin.Forms' that is compatible with 'Xamarin.Android.Support.v7.AppCompat 23.4.0.1'. Though Xamarin.Forms package is updated to the latestBotticelli
I had to update the Xamarin.Forms NuGet Package, that also updated the Xamarin.Android.Support Packages.Sumba
C
5

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)"

Corgi answered 4/4, 2017 at 3:14 Comment(0)
C
2

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>
Coagulant answered 21/9, 2018 at 18:45 Comment(0)
A
1

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.

Abstractionism answered 13/6, 2016 at 4:15 Comment(0)
H
1

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

Haiku answered 14/6, 2016 at 17:51 Comment(0)
P
1

Try one or all of these in the order given:

  1. Solution wide package restore
  2. Restart visual studio
  3. Clean & Rebuild

It solved the issue for me

Pinder answered 10/4, 2017 at 16:25 Comment(1)
It didnt, I even have to restart my laptop.Deluxe
Q
0

I switched from Xamarin Components to NuGet packages and it works now. MvvmCross installed the latest versions of packages Nuget (23.3.0) for its dependencies (MvvmCross.Droid.Support.V4, MvvmCross.Droid.Support.V7.AppCompat, MvvmCross.Droid.Support.V7.Preference ...). and components used earlier.

I also had to copy the "C:\Users\andres\AppData\Local\Xamarin" folder from my virtual machine.

In Visual Studio, I had no notification about an update available for the components.

Quire answered 15/6, 2016 at 9:33 Comment(0)
C
0

In my case, I was able to fix this problem by adding android-layout-xml.xsd and schemas.android.com.apk.res.android.xsd under XML -> Schemas menu (is accessible only when in a axml file). For the exact location of those files I suggest to do a search on the computer because they aren't in folder of Xamarin as suggested in other answers. In my case they were in the project under obj folder [obj -> Debug -> Schemas ...]

Hope this will help you with your problem.

Cheiron answered 12/2, 2017 at 9:43 Comment(0)
H
0

In my case the problem was that I have a local Nuget Package Server.

Took me a while to realize Xamarin Studio was trying to update the packages from the wrong source.

Hintz answered 14/3, 2017 at 20:14 Comment(0)
A
0

In my case, matching Xamarin.Support version to Target Framework version worked.

For example: If you are targeting 25 API then your Support libraries should also be 25.x..

Abrasion answered 15/6, 2017 at 13:5 Comment(0)
T
0

I had a similar issue when using MSBuild without Visual Studio on a virtual machine. I was trying to build a Xamarin Android project. It kept falling over with the message 'error retrieving parent for item theme.appcompat.light.darkactionbar.' I was able to resolve it by adding the argument /t:restore - for example

msbuild  /t:SignAndroidPackage /t:restore /p:Configuration=Release <project path>

Note the first time I ran it with the restore argument it still failed, but when I tried to build it again it worked. Hopefully this will help someone - it took me a few hours to configure MSBuild properly!

Tillett answered 2/10, 2018 at 8:40 Comment(0)
B
0

I was getting errors for attributes that were being referenced from styles, so renamed attrs.xml to Attrs.xml (and then back again when the error reoccurred after a clean rebuild).

Bailable answered 8/3, 2019 at 15:0 Comment(0)
T
0

I had the same problem after moving my project from one folder to another, on exactly the same laptop. I got it working via trial and error and still don't know the cause of the issue. Fixing it involved cleaning the solution a few times and restarting visual studio.

Thermophone answered 22/4, 2019 at 17:40 Comment(0)
T
0

Your compile SDK version must match the support library's major version.

Since you are using support library v23, you need to compile against Android SDK of v23.

Alternatively, you can continue compiling against v22 of the Android SDK by switching to the latest support library v22.

Tilney answered 29/6, 2019 at 17:41 Comment(0)
D
0

Deleting the cache folder in AppData may help

C:\Users\Your-User-name\AppData\Local\Xamarin.Android
Darvon answered 13/7, 2020 at 16:33 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.