I need to add the action bar for devices 2.3 and higher.
I recently knew about the appcompat v7 support library, which does exactly that.
I've followed the Support library setup guide, step by step, cleaned, built, and cleaned again, restarted eclipse, upgraded SDK and plugin to the last version (just to realise that SDK build tools v19 are broken, so I had to delete them). Two hours later I'm still unable to build my project. I'm getting these errors:
[2013-11-13 00:00:00 - FooProject] D:\foo_project\android-support-v7-appcompat\res\values-v11\themes_base.xml:33: error: Error: No resource found that matches the given name: attr 'android:windowActionBar'.
[2013-11-13 00:00:00 - FooProject] D:\foo_project\android-support-v7-appcompat\res\values-v11\themes_base.xml:42: error: Error retrieving parent for item: No resource found that matches the given name 'android:Theme.Holo.Light'.
[2013-11-13 00:00:00 - FooProject] D:\foo_project\android-support-v7-appcompat\res\values-v11\themes_base.xml:44: error: Error: No resource found that matches the given name: attr 'android:windowActionBar'.
[2013-11-13 00:00:00 - FooProject] D:\foo_project\android-support-v7-appcompat\res\values-v14\themes_base.xml:31: error: Error retrieving parent for item: No resource found that matches the given name 'android:Theme.Holo'.
[2013-11-13 00:00:00 - FooProject] D:\foo_project\android-support-v7-appcompat\res\values-v14\themes_base.xml:41: error: Error: No resource found that matches the given name: attr 'android:actionBarWidgetTheme'.
[2013-11-13 00:00:00 - FooProject] D:\foo_project\android-support-v7-appcompat\res\values-v14\themes_base.xml:57: error: Error retrieving parent for item: No resource found that matches the given name 'android:Theme.Holo.Light'.
[2013-11-13 00:00:00 - FooProject] D:\foo_project\android-support-v7-appcompat\res\values-v14\themes_base.xml:67: error: Error: No resource found that matches the given name: attr 'android:actionBarWidgetTheme'.
[2013-11-13 00:00:00 - FooProject] D:\foo_project\android-support-v7-appcompat\res\values-v14\themes_base.xml:83: error: Error retrieving parent for item: No resource found that matches the given name 'android:Theme.Holo.Light.DarkActionBar'.
[2013-11-13 00:00:00 - FooProject] D:\foo_project\android-support-v7-appcompat\res\values-v14\themes_base.xml:94: error: Error: No resource found that matches the given name: attr 'android:actionBarWidgetTheme'.
And I've tried everything in the following questions, to no avail:
Adding Support Libraries to Android project
After setting up android-support-v7-appcompat R.java is missing
Android Support Library v7: Error retrieving parent for item
Can't Find Theme.AppCompat.Light for New Android ActionBar Support
How to resolve the error "No resource found that matches the given name" when adding library v7 AppCompat in Eclipse?
I'm not saying those answers are not valid, just that for some reason they didn't work for me (I think it's because Google hates me).
Here are my manifest lines for the target sdk:
For the library:
<uses-sdk android:minSdkVersion="7"/>
and for the main project:
<uses-sdk android:targetSdkVersion="19" android:minSdkVersion="8"/>
Tried every possible combination, cleaning and building after each change, and still no luck.
Looks like this is a problem related to Holo. I really don't need Holo at all, only ActionBar. For now I'm just switching to ActionBarSherlock, which worked well for me in the past. But I'd really like to know what am I doing wrong, why something does not work despite I've spent a considerable ammount of time researching the issue. Why so much pain in integrating a library that should be usable out of the box.
Is it possible to get ONLY action bar with the support v7 library?
Finally got it working.
When adding ActionBarSherlock, the same kind of errors where appearing in the console.
I've edited the project.properties file (yeah, that one with the comment "This file is automatically generated by Android Tools. Do not modify this file -- YOUR CHANGES WILL BE ERASED")
Build target was set to 8, changed it to 16 and now it compiles with both ABS and appcompat v7.
UPDATE:
Here's how to do it the right way:
https://stackoverflow.com/a/3343050/813951
Have to look at ActionBarSherlock, it really helps, since your root request is add the action bar for devices 2.3 and higher
In my project, it works with android 2.2 to 4.x
When using Android Studio and build.gradle setup: bump up compileSdkVersion >= 14.
Related
I installed ADT on my Eclipse so I can develop Android apps. The issue is that every time I try to load the project, it shows lots of errors like these:
[2015-08-01 07:15:41 - AndroidApp1]
C:\Users\Arad\workspace\appcompat_v7\res\values-v21\themes_base.xml:137:
error: Error: No resource found that matches the given name: attr
'android:colorPrimaryDark'. [2015-08-01 07:15:41 - AndroidApp1]
[2015-08-01 07:15:41 - AndroidApp1]
C:\Users\Arad\workspace\appcompat_v7\res\values-v21\themes_base.xml:146:
error: Error: No resource found that matches the given name: attr
'android:windowElevation'. [2015-08-01 07:15:41 - AndroidApp1]
[2015-08-01 07:15:41 - AndroidApp1]
C:\Users\Arad\workspace\appcompat_v7\res\values-v21\themes_base.xml:150:
error: Error: No resource found that matches the given name: attr
'android:windowElevation'.
[2015-08-01 07:15:41 - AndroidApp1]
I found a similar question where it said to remove Android Wear ARM EABI v7a System Image so I uninstalled it and tried but without success. Later, I uninstalled the whole API 22, but still nothing and now it shows errors about API 21. What can I do about it?
Here is one thing to do:
After importing the library for appcompat-v7 right click and go to properties
Click Android and change the Project Build Target to API 21
Clean and rebuild
step 1 :
step 2 :
This should fix the issue of not finding the resources, I believe.
You need to make sure that you have installed the correct libs from the SDK manager and you've included v7-appcompat as a library project. You have to do this because v7-appcompat contains resource files that unlike android studio, are not added automatically by ADT.
See accepted SO answer here for more: appcompat-v7:21.0.0': No resource found that matches the given name: attr 'android:actionModeShareDrawable'
It's important to know that ADT is no longer supported. This means that it's no longer getting bug fixes or better support for newer features.
Relevant snippet from http://developer.android.com/tools/sdk/eclipse-adt.html
Google recommends switching to Android studio
If you have been using Eclipse with ADT, be aware that Android Studio is now the official IDE for Android, so you should migrate to Android Studio to receive all the latest IDE updates. For help moving projects, see Migrating to Android Studio.
Whilst trying to continue some work on my Android App, I came across numerous errors (which have been solved). However, I now receive around 100 errors all stating either
`error: Error: No resource found that matches the given name: attr 'ATTR NAME'`.
OR
`error: Error retrieving parent for item: No resource found that matches the given name 'RESOURCE NAME'`.
(ATTR NAME = attr 'android:colorPrimaryDark', attr 'android:colorAccent' etc.
RESOURCE NAME='android:Theme.Material.Light.Dialog','android:Theme.Material.Dialog'etc.)
I'm almost positive this is a Project Build Target error even though the targets for appcompat_v7 and my project is API_LEVEL 21. I have also removed any duplicated .jar files in the /lib folder as instructed to.
Any help is greatly appreciated as this problem has now consumed around 5-7 hours of my time.
Check if your support library has been updated alongside with your api level, then try cleaning your project.
Make sure you are using updated support library.
Hey Guys I need Some help here , I was testing and creating Apps with android 4.4 W and 2.2 froyo and recently I chose to install the Other android sdks such as 4.4.2 , 4.2.2 respectively and from there after I am getting the Above Error mentioned , I tried adding support libraries for the project and tried a couple of things mentioned on stackoverflow .
the errors when we first build the project are :
C:\Users\user\Documents\android-workspace\appcompat_v7\res\values-v21\themes_base.xml:190: error: Error: No resource found that matches the given name: attr 'android:colorPrimary'.
C:\Userprofile\Documents\android-workspace\appcompat_v7\res\values-v21\themes_base.xml:157: error: Error: No resource found that matches the given name: attr 'android:colorControlActivated'.
C:\Userprofile\Documents\android-workspace\appcompat_v7\res\values-v21\themes_base.xml:195: error: Error: No resource found that matches the given name: attr 'android:colorControlHighlight'.
the following are the errors : and not able to resolve android R Issue when i create a new project and working on it
Description Resource Path Location Type
error: Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Material.ActionButton'. styles_base.xml /appcompat_v7/res/values-v21 line 75 Android AAPT Problem
Description Resource Path Location Type
The container 'Android Dependencies' references non existing library 'C:\Users\user\Documents\android-workspace\appcompat_v7\bin\appcompat_v7.jar'
Follow these steps.
Right Click on the project
Go to properties.
Click Android from left.
In right you will see a list of android versions. Check the one with api level more than 18.
Click Ok, Now clean your project and rebuilt it again.
Hop it will remove your error.
Deleting all the <style> tag in the themes.xml file from the values-v21 folder and values-v14, values-v11 cleared this issue for me...
First of all i want to say that i know this topics have been brought up lots of times. But i can't seem to find the solution for this problem.
This is some of the errors from the log:
/home/name/adt-bundle-linux-x86_64-20140702/sdk/extras/android/support/v7/appcompat/res/values-v14/themes_base.xml:159: error: Error: No resource found that matches the given name: attr 'android:actionBarWidgetTheme'.
/home/name/workspace/Projectname/res/values-v14/styles.xml:4: error: Error: No resource found that matches the given name: attr 'android:actionBarStyle'.
/home/name/workspace/Projectname/res/values-v14/styles.xml:5: error: Error: No resource found that matches the given name: attr 'android:windowActionBar'.
/home/name/workspace/Projectname/res/values-v14/styles.xml:8: error: Error retrieving parent for item: No resource found that matches the given name '#android:style/Widget.Holo.ActionBar'.
I'v made a custom theme, and im using Actionbar.
<uses-sdk
android:minSdkVersion="9"
android:targetSdkVersion="9" />
All of this used to work, then i had to reinstall my eclipse, so i imported the project to the freshly installed one. And that is when the errors occurred.
The R.File is also missing.
Please help me, im starting to lose my mind becuase of this problem.
EDIT 1:
To clear things out. I added the android-support-v7-appcompat with this method (Adding libraries with resources):
http://developer.android.com/tools/support-library/setup.html
The project build target on android-support-v7-appcompat is Android 4.0 and the project build target on my project is Android 2.3.3.
Is this right? Im not really sure what it should be like.
I can't say exactly, but if you are using appcompt library,
Project(Right Click)--> Properties--> Android--> Library section--> Add--> appcompt library.
can you please check this once.
Edit :
Compile with API Level 14 - when you compile your app with SDK level 9, the compiler doesn't know the elements shown in the error log
Or Project(Right Click)--> Android Tools --> Add Support Library / Fix Project Property..
I am trying to build the Android project that uses appcompat_v7 library.
For that, I created my project through Eclipse -> New Android Sample Project and added my custom styles.xml and then added the appcompat_v7 library Project -> Properties -> Android -> Add.
But I am getting the following errors in appcompat_v7/res/values/styles_base.xml when I compile my project:
appcompat_v7/res/values/styles_base.xml:24: error: Error retrieving parent for item: No resource found that matches the given name 'Widget.AppCompat.Base'.
appcompat_v7/res/values/styles_base.xml:84: error: Error retrieving parent for item: No resource found that matches the given name 'Widget.AppCompat.Base'.
appcompat_v7/res/values/styles_base.xml:166: error: Error retrieving parent for item: No resource found that matches the given name 'Widget.AppCompat.Base'.
appcompat_v7/res/values/styles_base.xml:243: error: Error retrieving parent for item: No resource found that matches the given name 'Widget.AppCompat.Base'.
appcompat_v7/res/values/styles_base.xml:261: error: Error retrieving parent for item: No resource found that matches the given name 'Widget.AppCompat.Base.DropDownItem'.
appcompat_v7/res/values/styles_base.xml:319: error: Error retrieving parent for item: No resource found that matches the given name 'Widget.AppCompat.Base'.
appcompat_v7/res/values/styles_base.xml:323: error: Error retrieving parent for item: No resource found that matches the given name 'Widget.AppCompat.Light.Base'.
appcompat_v7/res/values/styles_base.xml:347: error: Error retrieving parent for item: No resource found that matches the given name 'TextAppearance.AppCompat.Base'.
appcompat_v7/res/values/styles_base.xml:391: error: Error retrieving parent for item: No resource found that matches the given name 'Widget.AppCompat.Base'.
appcompat_v7/res/values/themes_base.xml:189: error: Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat.Base'.
In my manifest I have declared 14 as my minSdkVersion and 19 as targetSdkVersion:
AndroidManifest.xml:
<uses-sdk
android:minSdkVersion="14"
android:targetSdkVersion="19" />
What can I do to fix these errors and build my project?
Check Build Target of your project and appcompat_v7 library project. They should be same, if your project has lesser Build Target than you get this error and won't be able to build.
To fix the problem in Eclipse go to Project->Properties->Android (Project Build Target) and select equal to your appcompat library project.
Right Click on the supporting library;
Click on Properties;
On the left side click on "Android";
Select the right "Android 5.0 - API 21" and click OK;
Clean the support library: Project -> Clean;
Repeat the above steps for your project.
When using the the appcompat_v7 library the targetSdkVersion should be the same number as the major Android Support Library version number. E.g. on my SDK installation the version number is 23.0.1 and so my targetSdkVersion should be 23 (Android 6.0)
I just ran into a similar issue when upgrading appcompat-v7 from 22.2.0 23.1.0. Updating compileSdkVersion to 23 fixed it.
Try this:
https://www.youtube.com/watch?v=HpXoCfoX_QY
Also, make sure your "appcompat_v7" library is open and you see the folders.
Check if Android Support Library and Android SDK Build-tools and Android SDK Platform-tools are updated.
I updated Android Support Library and not Build-tools and this error appeared. After updating Build-tools it solved.