I am trying to implement the new ActionBar support library that was released by Google a couple days ago. In the past, I have successfully implemented ActionBarSherlock without any issues using the same method listed on Google Developer's Support Library Setup page - using the guide on how to include the resources (which is similar to how ActionBarSherlock did it). I have the library project loaded in to my own project as a library as well.
I can tell the library is loading fine. When, instead of extending Activity on my MainActivity.java, I changed it to extend ActionBarActivity (as per Google's instructions), no errors occur - and it imports correctly.
I even tried bypassing the style.xml file and adding @style/Theme.AppCompat.Light
directly in to the AndroidManifest.xml for both <application>
and <activity>
with android:theme="@style/ThemeAppCompat.Light"
with all attempts resulting in the same error.
Now the issue is I cannot get it to change the theme, let alone even build without throwing an error. Below is the error I am receiving, followed by the style.xml file I changed to use the new theme.
I have moderate experience working with Android apps and am running Eclipse with the latest version of the Support Libraries and SDK compiling with API 18 (Android 4.3).
Error Received During Build
error: Error retrieving parent for item: No resource found that matches the given name '@style/Theme.AppCompat.Light'. styles.xml /ActBarTest/res/values line 3 Android AAPT Problem
style.xml
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="Theme.ProsoftStudio.ACTest" parent="@style/Theme.AppCompat.Light">
</style>
</resources>
Any suggestions? This was never an issue with ActionBarSherlock. I want to work on using this new support library. It almost seems like the .jar is loading, but not the resources.
The accepted solution used to work for me once, but not now. I had to re-create a hello-world of the same kind (!) in a new workspace, made it compile, and then copied all directories, including
.hg
and.hgignore
.hg diff
shows:It looks like Eclipse wants to compile for API 21 and fails to do anything with API 19. Darkly.
I had same problem and waste my 4-5 hours for solution. My problem solved with;
Hope you will find your solution.
I experienced the same problem as the OP after right-clicking on my project and selecting Close Unrelated Projects.
In my case, I resolved the problem by re-opening the appcompat_v7 project and cleaning/rebuilding both projects.
If you have added appCompat Library and also have given proper reference of appCompat from SDK location, try "invalidate caches/Restart".
You can find it from "File" menu in Android Studio.
I made a really silly mistake for this. When I was getting same error every time i could not figure out what was wrong. then it clicked me that once I have closed all the projects in my work space and that was the time since all the problems started. SO just check whether your "appcompat_v7" is not closed. If it is then open the project by double click and then clean and build your project again. In my case the errors were gone. Happy coding!
I am not sure whether v13 support library was available when this question was posted, but in case someone is still struggling, I have seen that adding
android-support-v13.jar
will fix everything. This is how I did it:<your sdk path>\extras\android\support\v13\android-support-v13.jar