0

I am some what new to android, and i got an application code which is a big project. I understand all the code written, but currently i got a problem. Before i explain the problem, i will list libs this application is using.

  1. ActionBarSherLock
  2. ImageLoader
  3. Below is the app settings of the android application in AndroidManifest file

    android:versionCode="7"
    android:versionName="2.0" >  
    
    <uses-sdk
    android:minSdkVersion="9"
    android:targetSdkVersion="18" />
    

I included the two libs in the application from Android category on the project properties. But current i got the following error

home cant be resolved

in all over the project. At places where i get this error, the below same code is placed:

if(item.getItemId()==android.R.id.home){

and the section android.R.id.home is giving error.

Edit : After cleaning the project, i got some errors in the console like below :

    [2013-09-10 16:04:30 - Othaim] D:\android\eclipse\ABS\res\values-v14\abs__styles.xml:22: error: Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Holo.ActionBar.TabBar'.
[2013-09-10 16:04:30 - Othaim] D:\android\eclipse\ABS\res\values-v14\abs__styles.xml:24: error: Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Holo.Light.ActionBar.TabBar'.
[2013-09-10 16:04:30 - Othaim] D:\android\eclipse\ABS\res\values-v14\abs__styles.xml:26: error: Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Holo.Light.ActionBar.TabBar.Inverse'.
[2013-09-10 16:04:30 - Othaim] D:\android\eclipse\ABS\res\values\abs__styles.xml:101: error: Error: No resource found that matches the given name: attr 'android:textAllCaps'.
[2013-09-10 16:04:30 - Othaim] D:\android\eclipse\ABS\res\values-v14\abs__styles.xml:29: error: Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Holo.ActionBar.TabText'.
[2013-09-10 16:04:30 - Othaim] D:\android\eclipse\ABS\res\values-v14\abs__styles.xml:31: error: Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Holo.Light.ActionBar.TabText'.
[2013-09-10 16:04:30 - Othaim] D:\android\eclipse\ABS\res\values-v14\abs__styles.xml:33: error: Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Holo.Light.ActionBar.TabText.Inverse'.
[2013-09-10 16:04:30 - Othaim] D:\android\eclipse\ABS\res\values-v14\abs__styles.xml:55: error: Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Holo.Light.ActionMode.Inverse'.
[2013-09-10 16:04:30 - Othaim] D:\android\eclipse\ABS\res\values\abs__styles.xml:328: error: Error: No resource found that matches the given name: attr 'android:textAllCaps'.
[2013-09-10 16:04:30 - Othaim] D:\android\eclipse\ABS\res\values-v14\abs__styles.xml:93: error: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Holo.Widget.ActionBar.Menu'.
[2013-09-10 16:04:30 - Othaim] D:\android\eclipse\ABS\res\values-v14\abs__styles.xml:96: error: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Holo.Widget.ActionBar.Title'.
[2013-09-10 16:04:30 - Othaim] D:\android\eclipse\ABS\res\values-v14\abs__styles.xml:98: error: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Holo.Widget.ActionBar.Title.Inverse'.
[2013-09-10 16:04:30 - Othaim] D:\android\eclipse\ABS\res\values-v14\abs__styles.xml:100: error: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Holo.Widget.ActionBar.Subtitle'.
[2013-09-10 16:04:30 - Othaim] D:\android\eclipse\ABS\res\values-v14\abs__styles.xml:102: error: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Holo.Widget.ActionBar.Subtitle.Inverse'.
[2013-09-10 16:04:30 - Othaim] D:\android\eclipse\ABS\res\values-v14\abs__styles.xml:104: error: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Holo.Widget.ActionMode.Title'.
[2013-09-10 16:04:30 - Othaim] D:\android\eclipse\ABS\res\values-v14\abs__styles.xml:106: error: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Holo.Widget.ActionMode.Title.Inverse'.
[2013-09-10 16:04:30 - Othaim] D:\android\eclipse\ABS\res\values-v14\abs__styles.xml:108: error: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Holo.Widget.ActionMode.Subtitle'.
[2013-09-10 16:04:30 - Othaim] D:\android\eclipse\ABS\res\values-v14\abs__styles.xml:110: error: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Holo.Widget.ActionMode.Subtitle.Inverse'.
[2013-09-10 16:04:30 - Othaim] D:\android\eclipse\ABS\res\values-v14\abs__styles.xml:113: error: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Holo.Widget.PopupMenu'.
[2013-09-10 16:04:30 - Othaim] D:\android\eclipse\ABS\res\values-v14\abs__styles.xml:115: error: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Holo.Widget.PopupMenu.Large'.
[2013-09-10 16:04:30 - Othaim] D:\android\eclipse\ABS\res\values-v14\abs__styles.xml:117: error: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Holo.Widget.PopupMenu.Large'.
[2013-09-10 16:04:30 - Othaim] D:\android\eclipse\ABS\res\values-v14\abs__styles.xml:119: error: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Holo.Widget.PopupMenu.Small'.
[2013-09-10 16:04:30 - Othaim] D:\android\eclipse\ABS\res\values-v14\abs__styles.xml:121: error: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Holo.Widget.PopupMenu.Small'.
[2013-09-10 16:04:30 - Othaim] D:\android\eclipse\ABS\res\values-v14\abs__themes.xml:8: error: Error retrieving parent for item: No resource found that matches the given name 'android:Theme.Holo.Light.DarkActionBar'.
[2013-09-10 16:04:30 - Othaim] D:\android\eclipse\ABS\res\values-v14\abs__themes.xml:14: error: Error: No resource found that matches the given name: attr 'android:actionBarWidgetTheme'.
[2013-09-10 16:04:30 - Othaim] D:\android\eclipse\Othaim\res\values-v11\styles.xml:3: error: Error retrieving parent for item: No resource found that matches the given name 'android:Theme.Holo.Light.DarkActionBar'.
[2013-09-10 16:04:30 - Othaim] D:\android\eclipse\Othaim\res\values-v11\styles.xml:5: error: Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Holo.ActionBar.TabBar'.
[2013-09-10 16:04:30 - Othaim] D:\android\eclipse\Othaim\res\values-v11\styles.xml:10: error: Error retrieving parent for item: No resource found that matches the given name 'android:Theme.Holo.Light.DarkActionBar'.
[2013-09-10 16:04:30 - Othaim] D:\android\eclipse\Othaim\res\values\styles.xml:26: error: Error retrieving parent for item: No resource found that matches the given name 'android:style/Widget.Holo.ActionBar.TabView'.

ABS is the project for ActionBarSherlock lib.

I also checked at my java files, and android.R is not imported. Also i have read the following posts on stack exchange :

Compiling error with API 10

R.id cannot be resolved on android ListActivity

R.id Cannot be resolved

but none of them fixed my issue.

Kindly help me in this issue.

Thank you

Community
  • 1
  • 1
Altaf Hussain
  • 5,166
  • 4
  • 30
  • 47
  • The android.R file you are referring to is generated at compile time, so in eclipse your settings is usually on auto compile, this will mean that you need to be able to compile your project, so all other compilation errors need to be fixed then the R file will be generated and the errors regarding it will go away. So fix any other issues and try compiling – Armand Sep 10 '13 at 12:25
  • Rename - if(item.getItemId()==android.R.id.home) to if(item.getItemId()==R.id.home) – Vishal Pawale Sep 10 '13 at 12:28
  • What is your build SDK version? It should be SDK 11 or newer. – laalto Sep 10 '13 at 12:28
  • android.R is the default android resources file, and if it is imported, it will look into the default resources. Yes my settings are at auto built. Current i have R.java file already there from the code. – Altaf Hussain Sep 10 '13 at 12:31
  • @laalto build sdk version is 10, can you explain why it should be 11 or higher ? – Altaf Hussain Sep 10 '13 at 12:33

1 Answers1

7

android.R.id.home was introduced in API level 11. To compile code using that constant, you need to set your build SDK to 11 or newer. Note that since it's a static final literal, it is inlined at compile time and you can run the code on lower API levels.

To answer your updated question: ActionBarSherlock requires build SDK 14 or higher, as stated in its faq:

Use of this library requires that both it and your project are compiled with Android 4.0 (API 14) or newer.

Generally, you should use the latest build SDK available (19 as of now). Just pay attention to Android Lint errors that notify you when you're trying to use functionality that is not available in your minSdkVersion.

laalto
  • 150,114
  • 66
  • 286
  • 303