Error retrieving parent for item: 'Theme.AppCompat.Light' in eclipse

user3316561 picture user3316561 · Oct 27, 2014 · Viewed 19.2k times · Source

I'm trying to use ActionBarActivity in my project. I've imported the android-support-v7-appcompat to the workspace as per the instruction in https://developer.android.com/tools/support-library/setup.html#

I could add the appcompat project as a library in my current project (eclipse).

Got the Green tick mark

And now there is no error when I use the following import statement.

import android.support.v7.app.ActionBarActivity;

And no error when I extend my class from ActionBarActivity.

public class MyClass extends  ActionBarActivity implements ActionBarListener  {....} 

But, I get errors while using the AppCompat style.

In manifest,

<activity
        android:name=".Activity1"
        android:label="@string/app_name"
        android:screenOrientation="portrait" 
        android:theme="@style/AppTheme"
        >
        ....

    </activity>

In styles.xml,

<style name="AppTheme" parent="AppBaseTheme">
    <!-- All customizations that are NOT specific to a particular API-level can go here. -->

</style>


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

I get the following error in styles.xml while using parent="Theme.AppCompat.Light" ** error: Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat.Light'.**

Why am I not able to access the resources from the appcompat support library.

P.s: I've not used android:showAsAction="never"

Both my application project and appcompat are in the same folder( I copied both to the current workspace).

Answer

Rohit picture Rohit · Oct 27, 2014

Try Replacing your Style.xml with this

<style name="AppBaseTheme" parent="android:Theme.Light">

Instead of

<style name="AppBaseTheme" parent="Theme.AppCompat.Light">