0

I am getting the typical "R cannot be resolved to a variable error" but I have currently tried what I feel to be almost every "fix" and I still can't get it to work. I think it has to do with the many errors I am getting from the res folder:

res\values\styles.xml:7: error: Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat.Light'.

res\values-v11\styles.xml:7: error: Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat.Light'.

res\values-v14\styles.xml:8: error: Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat.Light.DarkActionBar'.

and the many other similar errors that are to do with the xml files in the appcombat_v7 folder.

I have tried cleaning the project, building the project, I have updated my android sdk tools and ADT for eclipse to the newest version, I am using android 4.4 for the target of the project.

any help would be nice

EDIT: Also get this error: WARNING: unable to write jarlist cache file H:\Workspace\appcompat_v7\bin\jarlist.cache And this on the activity_main.xml in the layout folder: The project target (Android 5.0) was not properly loaded.

Corey
  • 1
  • 1
  • are you using ActionBarActivity or Activity? – Mohammed Ali Nov 19 '14 at 12:55
  • it extends it in the first class that is made when I create a new program "import android.support.v7.app.ActionBarActivity;" but other than that idk if i use it or don't use it tbh I am an eclipse noob and haven't even made anything yet just keep getting these errors every time I make a new android project. – Corey Nov 20 '14 at 10:20

4 Answers4

0

Delete these files

  • res\values\styles.xml
  • res\values-v11\styles.xml
  • res\values-v14\styles.xml

then in your manifest under aplication tag remove this line also

    android:theme="yourTheme"

or alternatively you can do one more thing. add the appCompact Library to Your project

Abdul Mohsin
  • 1,253
  • 1
  • 13
  • 24
  • thanks for the answer. I tried all of the steps and it did not change anything and I still keep getting errors like this: "No resource found that matches the given name: attr 'android:colorPrimaryDark'." – Corey Nov 20 '14 at 09:29
0

it seems you are not importing appcompat support package...

Adding the action bar when running on versions older than Android 3.0 (down to Android 2.1) requires that you include the Android Support Library in your application.

please follow the link for setting up the appcompat library

http://developer.android.com/tools/support-library/setup.html

Sam
  • 4,046
  • 8
  • 31
  • 47
  • I did all of the steps that were mentioned on the website to add the library with resources but it did not work... I also updated my support library and support repository but still get the same errors. I already have the appcompat_v7 there anyway when I make a project. i reinstalled the support library's and did the steps again but still didn't work – Corey Nov 20 '14 at 10:17
0

Seems you have not imported appcompat_v7 properly. Try this:
1. Right Click Project --> properties --> Android --> Library section --> Add appcompat_v7.
2. Now clean and build everything.

Mohammed Ali
  • 2,758
  • 5
  • 23
  • 41
  • thanks for the answer but it was already in the library section. I removed it and added it again then cleaned it just in case and it still didn't work. – Corey Nov 20 '14 at 09:25
  • Also check your proj->properties->java Build path->order&Export check if there are two versions of appcompat_v7 or android-support-v7-appcompat.jar, remove one of them. Also in your proj->libs check if there is in \libs\android-support-v7-appcompat.jar remove it. – Mohammed Ali Nov 20 '14 at 12:21
0

modify project.properties file in both appcompat_v7, yourProject Projects from target=android-19 to target=android-21

Prudhvi
  • 2,276
  • 7
  • 34
  • 54