3

I just started android programming and i am stuck in this problem from many days , whenever i start a new project every time i get these 5 errors , i don't know what to do with them , i tried setting up whole SDK and eclipse setup but still i get these errors , Any one know about how to get rid of theses ???

  1. R cannot be resolved to a variable
  2. Error retrieving parent for item: No resource found that matches the given name 'android:Theme.Holo.Light.DarkActionBar',styles.xml/example/res/values-v14line 3 Android AAPT Problem
  3. Error retrieving parent for item: No resource found that matches the given name 'android:Theme.Light'.styles.xml/example/res/values line 3 Android AAPT Problem
  4. Error retrieving parent for item: No resource found that matches the given name 'android:Theme.Holo.Light'.styles.xml/example/res/values-v11 line 3 Android AAPT Problem
Aerrow
  • 12,086
  • 10
  • 56
  • 90
user1623228
  • 31
  • 1
  • 2

4 Answers4

5

For those stumbling upon this question, here's a solution: In your project.properties, change target=android-x where x < 11 to some x >= 11 e.g target=android-14, because holo was introduced first in android-11 (Honeycomb).

EDIT:

Correction, x>=14 for android:Theme.Holo.Light.DarkActionBar to work.

iceman
  • 826
  • 13
  • 25
1

For error number 2,3 and 4. In your styles.xml file remove the parent="android:Theme", i used in following way

styles.xml

<?xml version="1.0" encoding="utf-8"?>
<resources>
  <style name="CustomWindowTitleBackground">

    </style>


    <style name="MyTheme" parent="android:Theme">
        <item name="android:windowTitleSize">65dip</item>
        <item name="android:windowTitleBackgroundStyle">@style/CustomWindowTitleBackground</item>
    </style>
</resources>

May i hope this will be solve your First Error. Incase your first error wont clear means, just clean the your application and then run it.

Aerrow
  • 12,086
  • 10
  • 56
  • 90
  • If this works, you should no longer have your first error. Until your resources 'compile' correctly, you will probably get an error with 'R' not being available (as this is what the 'compilation' of your resources produces for your project). – Sam Aug 24 '12 at 17:41
  • @Sam: ya accepted, this my hope only. Because i got these kind of problem in my application. That's why i mentioned. – Aerrow Aug 24 '12 at 17:53
  • 1
    Thanx for your help guyz but i just find out that i was using the wrong api, I have corrected that and now its good to go !!! – user1623228 Aug 24 '12 at 19:57
  • Please post what you did to fix the issue and mark it as the answer. this helps other people when they stumble upon this post searching for answers – Malachi Sep 28 '12 at 20:35
  • @Malachi: In my answer i mentioned clearly what i was done. Did you expect more? – Aerrow Sep 29 '12 at 02:41
  • more or less the OP posted a comment here that says they were using the wrong API, so I was talking to the OP, sorry if I caused confusion. – Malachi Oct 01 '12 at 18:22
0

Clean your project: Project->Clean

Also, make sure you did not import "android.R". Eclipse tends to add this sometimes when you manage the imports.

Shubham
  • 780
  • 3
  • 13
  • 32
  • Thanx for your help guyz but i just find out that i was using the wrong api, I have corrected that and now its good to go !!! – user1623228 Aug 24 '12 at 19:43
  • Thanx for your help guyz but i just find out that i was using the wrong api, I have corrected that and now its good to go !!! – user1623228 Aug 24 '12 at 19:58
0

when you add a resource to the project you have to update the XML Files associated with it. it will be in a folder probably named res in that folder will be several other folders called drawable layout and values they have XML Files inside them that need to be updated when you ad a resource such as a picture or a string to your project.

I might have the folders wrong, it has been a while since I programmed in Android.

Malachi
  • 3,205
  • 4
  • 29
  • 46