user3316561
user3316561

Reputation: 586

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

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

Upvotes: 1

Views: 19492

Answers (2)

user3316561
user3316561

Reputation: 586

Worked with just a small change in styles.xml

Change

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

to

<style name="AppBaseTheme" parent="@style/Theme.AppCompat">
    ...
</style>

Upvotes: 1

Rohit
Rohit

Reputation: 810

Try Replacing your Style.xml with this

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

Instead of

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

Upvotes: 6

Related Questions