No resource found that matches the given name "Theme.AppCompat.Light"

Hi Xamarinians

I have upgraded the support library packages to v23. After that I am getting this error in the style.xml files

Error APT0000: Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat.Light.DarkActionBar'. (APT0000)

Here is my style file

  <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
    <item name="windowNoTitle">true</item>
....

I have to go back to the older version, any idea why is this happening?

Thank you

Tagged:
«1

Answers

  • YkshLeoYkshLeo USMember ✭✭✭✭

    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.

  • vijay11379vijay11379 INMember

    I have resolved it using same SDK of Android(API 23 as target API) as App comp lib idk version(v23.4).

  • vijay11379vijay11379 INMember

    but now after some time, i got again this issue with same api's versions. i don't know Why? Please help someone.

  • JuanAguilarJuanAguilar COMember

    como soluciono este error??? e utilizado todas las api y ninguna me soluciona el error, también borre los archivos temporales y nada que me deja que puedo hacer?

  • jutervojutervo USMember ✭✭

    I just ignored the thing and managed to get build / apk done but as said there is too many things that seems to cause random problems in the dev environment.

  • AdrianChiriacAdrianChiriac USMember
    edited February 2017

    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 ...]

    Also, if the Intellisense stops working, then VS needs to be restarted.

    Hope this will help you with your problem.

  • MichaelChengMichaelCheng SGMember ✭✭

    Nuget Xamarin.Android.Support.v7.

  • NickyZANickyZA USMember

    This is so frustrating. Struggling with the same problem. API levels all the same, deleted contents of the Xamarin folder, built and rebuilt the project to no avail.

    It is even more frustrating because I have just been to the Microsoft Connect conference where they spend hours praising Xamarin. Typical Microsoft marketing hype.

  • ada2025ada2025 PHMember

    I tried everything above but nothing worked, I just started a new project but it's failing on build, anyone got other solution for this?

  • DimChrisDimChris USMember ✭✭✭
    edited February 2017

    Why dont you use default template which application gives you?
    Example in designers method of layout just select properties,background and give your template from there.And use a linearlayout for giving color in your bar.

  • I have the same problem.
    I have SDK 7.1.1 (API 25) 7.0
    Installed SDKs
    7.1.1 (API 25)
    7.0
    Xamarin.Android.Support.v7.AppCompat v25.1.0
    Xamarin.Android.Support.v4 v25.1.1
    I have no clue what is wrong. Why does it I have version 25.1.0 installed but gives me the option of updating 20 previous version? What version of Xamarin.Android.v4 am I supposed to be using?

  • BohdanBBohdanB USMember

    I've fixed the error Resources\values\styles.xml(2): error APT0000: Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCom... by reverting all Xamarin.Android.Support libraries to v23.4.0.1.

  • RubenRuedaRubenRueda USMember

    Please as I change the version of libraries xamarin.Android. Support the truth i am new and if someone helps me with this information it would help me a lot

  • MattHerndonMattHerndon USMember

    Just started working with Xamarin thinking it might be an easy way to write multiplatform apps. Been running through the first few lessons of Xamarin University and liking it. Then I switched it to try and build the app for Android and got this error. What is the point of a multiplatform dev environment if it errors on one of the two platforms out of the box?

    As for solutions I see above "Since you are using support library v23, you need to compile against Android SDK of v23." but I don't know how to actually make this change. Can someone give more explicit directions?

  • JessCastroJessCastro USMember

    @MichaelCheng said:
    Nuget Xamarin.Android.Support.v7.

    It worked for me! I'd also add another package: Xamarin.Android.Support.v4. Next, clean all and rebuild.

  • tdownstdowns USMember

    @MattHerndon I agree with you. I'm having the same problem, haven't changed a single character from an example Xamarin Forms app in visual studio for mac. Not really encouraging when I'm evaluation using xamarin for work project and there isn't even an example that works out of the box. It's pathetic.

  • RobinSchroeder.8683RobinSchroeder.8683 USMember ✭✭

    @JBhinder said:
    for my project, option "Rebuild all" fix the issue... thanks

    +1

  • JoeyGMJoeyGM USMember

    Installing the AppCompat should be the solution since the error says that no item found Theme.AppCompat.Light.DarkActionBar.

    I added the Xamarin.Android.Support.v7.AppCompat nuget in my android project and it worked.

  • Anyone please help me to resolve the issue. I have tried all the steps mentioned but none helped me...

    Could not install package 'Xamarin.Android.Support.v7.AppCompat 25.3.1'. You are trying to install this package into a project that targets 'MonoAndroid,Version=v2.3', but the package does not contain any assembly references or content files that are compatible with that framework. For more information, contact the package author.

  • RochaPiresRochaPires PTMember ✭✭

    I've been trying to correct this error for almost a week, without success.
    I'm targeting Android SDK 25 and minimum version 16.
    I have Xamarin.Android.Support.v7.AppCompat v25.3.1 Nuget in my project.

    Tried to delete all content from C:\Users\user\AppData\Local\Xamarin, clean solution, remove bin and obj files, but none of these solved the problem.

    Do you guys have any clue on what is causing this error?

    This is my styles.xml file:
    <style name="MyTheme" parent="android:Theme.AppCompat"></style>

    And the manifest:
    <application android:label="App" android:theme="@style/MyTheme" android:icon="@drawable/Icon"></application>

    If my in my manifest I use AppCompat theme, I can run the app but if my custom theme extends AppCompat, I get the error
    <application android:label="App" android:theme="@style/Theme.AppCompat" android:icon="@drawable/Icon"></application>

    Thank you.

  • RochaPiresRochaPires PTMember ✭✭

    The problem is that the Theme path was wrong.
    The right one is:
    parent="Theme.AppCompat" instead of parent="android:Theme.AppCompat".

  • KokulJoseKokulJose INMember ✭✭

    Clean And Rebuild is what i have done..... and the issue solved.

  • BrianConradBrianConrad USMember ✭✭

    I ran into this when adding the Google Drive support. A full clean and build solved but now the ResolveLibraryProjectsImports is popping probably because something in the Drive support package has too long a name. I suppose now I'll need to move the project out to a root folder on Windows. Something needs to be done about Windows archaic path limitation but I suppose that opens up all kinds of problems.

  • @UdaraAlwis said:
    I resolved this by deleting everything in the "C:\Users\\AppData\Local\Xamarin\zips" folder and cleaning and rebuilding my project.
    Looks like its caused by corrupted ZIP files in this folder which get's downloaded during the compilation if you don't have specific Android dlls that are required by your project to build. So probably those downloads may have gotten interrupted there by causing corrupted ZIPs of those Android dlls.
    So by deleting them in the above folder, forces VS to re-download them again, and it will probably complete the downloading of those ZIP-ed dlls properly and unzip itself to build your project. :)
    Hope it helps.

    Cheers!

    It worked for me. Thank a lot

  • KhaledHikmatKhaledHikmat USMember ✭✭

    A little late....but if u r still having issues, please consult Xamarin's James Montemagno blog on mastering the Android support libraries: https://blog.xamarin.com/mastering-android-support-libraries/

  • KhaledHikmatKhaledHikmat USMember ✭✭

    Oh...in case you are wondering where to find out the support libraries version number, you need to open up the packages.config file. Please see attached. Thanks.

  • voodarkvoodark USMember

    In my case, what solved this issue was adding the new SDKs with the android SDK Manager.
    After that, everything compiled and worked as expected.

  • RamkalRamkal USMember

    Just manage Nuget Packages and update the Xamarin.Android.Support.v7 and any other thing you are missing

    these kind of problems occur when you download a sample or try to build a solution on your computer which is made originally in another computer OR after you create a project in your PC you update or install something (like some SDKs) and in VisualStudio you need to sync your project with new changes you made out od VS.

  • VladisVladis USMember ✭✭
    edited January 2018

    Trying to solve this issue using a local Build Agent

    I created a brand new Xamarin Forms Shared Application.
    Updated Xamarin forms nuget Package (automatically updates android support).
    Built, worked.
    Checked in.

    Ran the build agent, and it failed with the same errors. I have downloaded the necessary sdk on the build agent so I am not sure what my next step would be at this point.

    DefineBuildTargetAbis: Build target ABI: armeabi-v7a Resources\values\styles.xml(0,0): Error APT0000: 1: error: Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat.Light.DarkActionBar'. Resources\values\styles.xml : error APT0000: 1: error: Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat.Light.DarkActionBar'. [C:\myagent\_work\2\s\Scratch\myUser\XamarinTest\TestApp\TestApp.Android\TestApp.Android.csproj] Resources\values\styles.xml(0,0): Error APT0000: 2: error: Error: No resource found that matches the given name: attr 'colorAccent'. Resources\values\styles.xml : error APT0000: 2: error: Error: No resource found that matches the given name: attr 'colorAccent'. [C:\myagent\_work\2\s\Scratch\myUser\XamarinTest\TestApp\TestApp.Android\TestApp.Android.csproj] Resources\values\styles.xml(0,0): Error APT0000: 1: error: Error: No resource found that matches the given name: attr 'colorPrimary'. Resources\values\styles.xml : error APT0000: 1: error: Error: No resource found that matches the given name: attr 'colorPrimary'. [C:\myagent\_work\2\s\Scratch\myUser\XamarinTest\TestApp\TestApp.Android\TestApp.Android.csproj] Resources\values\styles.xml(0,0): Error APT0000: 1: error: Error: No resource found that matches the given name: attr 'colorPrimaryDark'. Resources\values\styles.xml : error APT0000: 1: error: Error: No resource found that matches the given name: attr 'colorPrimaryDark'. [C:\myagent\_work\2\s\Scratch\myUser\XamarinTest\TestApp\TestApp.Android\TestApp.Android.csproj] Resources\values\styles.xml(0,0): Error APT0000: 1: error: Error: No resource found that matches the given name: attr 'windowActionBar'. Resources\values\styles.xml : error APT0000: 1: error: Error: No resource found that matches the given name: attr 'windowActionBar'. [C:\myagent\_work\2\s\Scratch\myUser\XamarinTest\TestApp\TestApp.Android\TestApp.Android.csproj] Resources\values\styles.xml(0,0): Error APT0000: 3: error: Error: No resource found that matches the given name: attr 'windowActionModeOverlay'. Resources\values\styles.xml : error APT0000: 3: error: Error: No resource found that matches the given name: attr 'windowActionModeOverlay'. [C:\myagent\_work\2\s\Scratch\myUser\XamarinTest\TestApp\TestApp.Android\TestApp.Android.csproj] Resources\values\styles.xml(0,0): Error APT0000: 1: error: Error: No resource found that matches the given name: attr 'windowNoTitle'. Resources\values\styles.xml : error APT0000: 1: error: Error: No resource found that matches the given name: attr 'windowNoTitle'. [C:\myagent\_work\2\s\Scratch\myUser\XamarinTest\TestApp\TestApp.Android\TestApp.Android.csproj] Resources\values\styles.xml(0,0): Error APT0000: 3: error: Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat.Light.Dialog'. Resources\values\styles.xml : error APT0000: 3: error: Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat.Light.Dialog'. [C:\myagent\_work\2\s\Scratch\myUser\XamarinTest\TestApp\TestApp.Android\TestApp.Android.csproj] Resources\values\styles.xml(0,0): Error APT0000: 3: error: Error: No resource found that matches the given name: attr 'colorAccent'. Resources\values\styles.xml : error APT0000: 3: error: Error: No resource found that matches the given name: attr 'colorAccent'. [C:\myagent\_work\2\s\Scratch\myUser\XamarinTest\TestApp\TestApp.Android\TestApp.Android.csproj] Done Building Project "C:\myagent\_work\2\s\Scratch\myUser\XamarinTest\TestApp\TestApp.Android\TestApp.Android.csproj" (PackageForAndroid target(s)) -- FAILED. Build FAILED.

    " (PackageForAndroid target) (1) ->
    (_UpdateAndroidResgen target) ->
    Resources\values\styles.xml : error APT0000: 1: error: Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat.Light.DarkActionBar'. [
    Resources\values\styles.xml : error APT0000: 2: error: Error: No resource found that matches the given name: attr 'colorAccent'. [
    Resources\values\styles.xml : error APT0000: 1: error: Error: No resource found that matches the given name: attr 'colorPrimary'. [
    Resources\values\styles.xml : error APT0000: 1: error: Error: No resource found that matches the given name: attr 'colorPrimaryDark'. [
    Resources\values\styles.xml : error APT0000: 1: error: Error: No resource found that matches the given name: attr 'windowActionBar'. [
    Resources\values\styles.xml : error APT0000: 3: error: Error: No resource found that matches the given name: attr 'windowActionModeOverlay'. [
    Resources\values\styles.xml : error APT0000: 1: error: Error: No resource found that matches the given name: attr 'windowNoTitle'. [
    Resources\values\styles.xml : error APT0000: 3: error: Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat.Light.Dialog'. [
    Resources\values\styles.xml : error APT0000: 3: error: Error: No resource found that matches the given name: attr 'colorAccent'. [
    0 Warning(s)
    9 Error(s)
    Time Elapsed 00:00:02.36`

  • arueda_1980arueda_1980 Member ✭✭

    In my case Rebuild all, i open VS with Execute as an administrator

  • StarnStarn Member

    So I changed my target framework for android and this worked perfectly.

  • NielsCupNielsCup NLMember ✭✭✭
    edited March 2018

    I shipped a release build to the Play Store Alpha channel and it crashed and burned on startup after installing it via the Play Store. When deploying a release build on my device this error popped up. Switching to debug and everything is running fine.

    So I deleted my bin and object folder, rebuild (release) and I got the same error.
    Then I deleted my bin and object folder again, restarted Visual Studio (mac), rebuild (release) and deploy to device and it runs fine.

    Where does this go wrong?

  • ThibaultDThibaultD SEMember ✭✭✭

    I did experience the exact same issue.

    Cleaning from Visual Studio (for Mac) did not help, though build was fine in VS. I only got the error when trying to build with msbuild command-line.
    After I removed all bin and obj folders, everything built without errors.

    While the fix was an easy one it still took me a lot of time to find out and I agree with other users here who think that there's too much wild-guessing-debuging related to using Xamarin developer tools and understanding their bugs.

  • darkni18darkni18 Member

    I had this same problem. What I did was rebuild the Android part of the project then rebuilding the General part of the project. Doing these individually and after that hitting F5 seem to work for me.
    I hope this helps.

Sign In or Register to comment.