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

AndroidAndroid Appcompat

Android Problem Overview


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

Android Solutions


Solution 1 - Android

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.

Solution 2 - Android

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

Solution 3 - Android

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.

Solution 4 - Android

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

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionSauronView Question on Stackoverflow
Solution 1 - AndroidRaghunandanView Answer on Stackoverflow
Solution 2 - AndroidVinsView Answer on Stackoverflow
Solution 3 - AndroidMick ByrneView Answer on Stackoverflow
Solution 4 - AndroidSummved JainView Answer on Stackoverflow