67

I have been on this problem for a couple hours. After downloading a repository from github, the only error in any .xml file is:

No resource found that matches the given name '@style/Theme.AppCompat.Light'

The code is very straightforward, but there is not one straightforward answer I have found, on how to alleviate the error.

here is the code (in file res/values/styles.xml):

<style name="AppBaseTheme" parent="@style/Theme.AppCompat.Light">
    <!-- API 14 theme customizations can go here. -->
</style>

The project is located at: https://github.com/erikswed/InstaChatX I am on Windows, using Eclipse Kepler

Sunil Garg
  • 14,608
  • 25
  • 132
  • 189
Sauron
  • 6,399
  • 14
  • 71
  • 136

4 Answers4

71

What are the steps for that? where is AppCompat located?

Download the support library here:

http://developer.android.com/tools/support-library/setup.html

If you are using Eclipse:

Go to the tabs at the top and select ( Windows -> Android SDK Manager ). Under the 'extras' section, check 'Android Support Library' and check it for installation.

enter image description here

After that, the AppCompat library can be found at:

android-sdk/extras/android/support/v7/appcompat

You need to reference this AppCompat library in your Android project.

Import the library into Eclipse.

  1. Right click on your Android project.
  2. Select properties.
  3. Click 'add...' at the bottom to add a library.
  4. Select the support library
  5. Clean and rebuild your project.
Sunil Garg
  • 14,608
  • 25
  • 132
  • 189
Raghunandan
  • 132,755
  • 26
  • 225
  • 256
  • 1
    I'm on windows, but that does not work...is there anything else that would work? – Sauron Jan 11 '14 at 07:35
  • 2
    I hate to ask this, but could you provide more detailed steps? – Sauron Jan 11 '14 at 07:39
  • @Eatlon what more do you need. It does not matter whether on window sor linux – Raghunandan Jan 11 '14 at 07:57
  • @Eatlon the appcompact is always located @ `android-sdk/extras/android/support/v7/appcompat` under the android-sdk. You need to download that first. pls look at the docs. it does not work which step does not work. what details you need – Raghunandan Jan 11 '14 at 07:57
  • @Eatlon i have used it many times. I am sure if you do it right it will work. Also it does not work. I see no code no snap shots nothing. How do you expect me to help further? And what project are you using.? No info – Raghunandan Jan 11 '14 at 08:03
  • thank you, I have provided the location of the project I am working on. (Minor detail is changing a few switch/case to if-then before working on it) Do you have an email address? – Sauron Jan 11 '14 at 08:19
  • @Eatlon i do but it is not for personal assistance and post how you referenced AppCompat. The project required AppCOmpat – Raghunandan Jan 11 '14 at 09:49
  • 4
    Thanks for the help, but I ended up following these instructions and it worked perfectly. Just like the 'using eclipse' tag:http://developer.android.com/tools/support-library/setup.html#libs-with-res – Sauron Jan 11 '14 at 19:12
  • yes I will, but I'm relatively newer to Android and have been looking for someone to work with on this project. It's particularly interesting and has a new application to the market. Any interest in working on it? – Sauron Jan 11 '14 at 22:35
  • 1
    Thank you Raghunandan. I have been searching for this solution for a few days (in my spare time thank goodness)! – kyle Jun 11 '14 at 03:31
  • I didn't have "Android Support Library" in "Android SDK Manager".Here is information how I found it: http://stackoverflow.com/a/11533149/1970278 – panako Aug 15 '16 at 19:14
  • In the version of the SDK manager that I have (25.2.5), I do not see the Android Support Library there. I am getting this same error but cannot fix the problem with this recommended solution. – Christian Findlay Dec 08 '17 at 02:31
  • @MelbourneDeveloper Can you post a screen shot of your sdkmanager with Android-Studio – Raghunandan Dec 08 '17 at 07:21
18

If you are looking for the solution in Android Studio :

  1. Right click on your app
  2. Open Module Settings
  3. Select Dependencies tab
  4. Click on green + symbol which is on the right side
  5. Select Library Dependency
  6. Choose appcompat-v7 from list
Vins
  • 4,089
  • 2
  • 35
  • 50
  • I have same problem, but it didn't work for me: Error:(4, -1) android-apt-compiler: [main16] D:\Android-Studio-Prj\Android\core\src\main\res\values\styles.xml:4: error: Error retrieving parent for item: No resource found that matches the given name 'AppCompat.Light'. – user3806649 Apr 01 '17 at 19:26
3

The steps described above do work, however I've encountered this problem on IntelliJ IDEA and have found that I'm having these problems with existing projects and the only solution is to remove the 'appcompat' module (not the library) and re-import it.

Mick Byrne
  • 14,394
  • 16
  • 76
  • 91
2

Below are the steps you can try it out to resolve the issue: -

  1. Provide reference of AppCompat Library into your project.
  2. If option 1 doesn't solve the issue then you can try to change the style.xml file to below code.
 parent="android:Theme.Holo.Light"  

instead.

 parent="android:Theme.AppCompat.Light"  

But option 2 will require minimum sdk version 14.

Hope this will help !

Summved

knight
  • 105
  • 2
  • 5
Summved Jain
  • 872
  • 2
  • 18
  • 21
  • Intente muchas de las soluciones propuestas en otros foros y esta fue la unica que me funciono en Eclipse NEON, En los menus cambie "app" por xmlns:compat="schemas.android.com/apk/res-auto" .... compat:showAsAction="never"/> además el mínimo de versión en manifest. Además agregue la librería como referencia externa android-support-v7-appcompat.jar y funciono. – Pedro Castillo Jul 09 '18 at 05:12
  • This will process javac without error. But then fatal program exception: `java.lang.NoClassDefFoundError: Failed resolution of: Landroid/support/v7/appcompat/R$styleable;` – gotwo Feb 15 '20 at 20:36