Reputation: 10059
I am getting this error in styles.xml:
error: Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat.Light'.
<style name="AppTheme" parent="AppBaseTheme"></style>
<style name="AppBaseTheme" parent="Theme.AppCompat.Light"> --->Error line
<item name="colorPrimary">@color/holo_orange</item>
<item name="colorPrimaryDark">@color/holo_orange_dark</item>
</style>
Then right click on the project->properties ->Android
Then my manifest:
<uses-sdk
android:minSdkVersion="16"
android:targetSdkVersion="21" />
.......
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppBaseTheme" >
......
</application>
Order and Export:
I am sure I had updated my sdk to the latest version 21 in Build tools,platform tools,Extras,etc.. I didn't know why this error still occurred.I tried restarting my eclipse and cleaning the project.Still it occurs.
Upvotes: 2
Views: 13505
Reputation: 10059
User ρяσѕρєя K comment helped me to solve this error.He told me to add the Appcompat library
in my project.
For more description: Can't Find Theme.AppCompat.Light for New Android ActionBar Support
All credits goes to User ρяσѕρєя.
Upvotes: 2
Reputation: 602
As said in comment. You need to add the appcompat to your project in order to get this theme.
https://developer.android.com/training/material/compatibility.html
To add a support library in eclipse
https://developer.android.com/tools/support-library/setup.html
Adding libraries with resources
To add a Support Library with resources (such as v7 appcompat for action bar) to your application project:
Using Eclipse
Create a library project based on the support library code:
Make sure you have downloaded the Android Support Library using the SDK Manager.
Create a library project and ensure the required JAR files are included in the project's build path: Select File > Import. Select Existing Android Code Into Workspace and click Next.
Browse to the SDK installation directory and then to the Support Library folder. For example, if you are adding the appcompat project, browse to /extras/android/support/v7/appcompat/.
Click Finish to import the project. For the v7 appcompat project, you should now see a new project titled android-support-v7-appcompat.
In the new library project, expand the libs/ folder, right-click each .jar file and select Build Path > Add to Build Path. For example, when creating the the v7 appcompat project, add both the android-support-v4.jar and android-support-v7-appcompat.jar files to the build path.
Right-click the library project folder and select Build Path > Configure Build Path.
In the Order and Export tab, check the .jar files you just added to the build path, so they are available to projects that depend on this library project. For example, the appcompat project requires you to export both the android-support-v4.jar and android-support-v7-appcompat.jar files.
Uncheck Android Dependencies. Click OK to complete the changes. You now have a library project for your selected Support Library that you can use with one or more application projects.
Add the library to your application project:
In the Project Explorer, right-click your project and select Properties. In the category panel on the left side of the dialog, select Android. In the Library pane, click the Add button.
Select the library project and click OK. For example, the appcompat project should be listed as android-support-v7-appcompat.
In the properties window, click OK.
Upvotes: 0