I create a new android application minimum-target-compiler version is set to api level 10, deployed successful. But when i added support library to the project R.java disappeared in gen folder. Error is, R can not be resolved to a variable, please see the screenshot. There is no error in xml. I am getting error in console. I cleaned and build but did not work.
Asked
Active
Viewed 413 times
0
-
Try Clean & Build your project. – Himanshu Agarwal Mar 27 '14 at 10:22
-
Consider including the image instead of linking to it. – Ahmad Dwaik 'Warlock' Mar 27 '14 at 10:23
-
http://stackoverflow.com/a/3389640 – Sree Mar 27 '14 at 10:24
-
@Himani Agarwal, i have cleaned and build the project – Shashi Shiva L Mar 27 '14 at 10:24
-
Have you added the support-v4 library in your project ? – GrIsHu Mar 27 '14 at 10:28
-
@Rethinavel Pillai, there is no "import android.R;" in the import statements. – Shashi Shiva L Mar 27 '14 at 10:28
-
@GrIsHu , yes i added the support-v4 library in your project. – Shashi Shiva L Mar 27 '14 at 10:29
-
show your build path. Make sure there is not two library added in your build path. The error may be occurring because of dependencies also. – GrIsHu Mar 27 '14 at 10:33
-
@GrIsHu , thank you please see the build path http://www.evernote.com/shard/s283/sh/c0552f88-bb84-4079-9a21-e66ede7743b3/131fdefa6ca3584fb7fa71002a4559f1 error not solved – Shashi Shiva L Mar 27 '14 at 10:38
-
1@Shiva Its dependencies issue. Just remove the Android-Dependencies library and try to clean your project again . – GrIsHu Mar 27 '14 at 10:40
-
@GrIsHu , i unchecked the Android Dependencies and clean and build the project but error did not disappear. – Shashi Shiva L Mar 27 '14 at 10:46
-
@Shiva Do not uncheck just remove it. – GrIsHu Mar 27 '14 at 10:50
-
@GrIsHu , i removed as you said but after Remove it(Android Dependencies) appeaser again. – Shashi Shiva L Mar 27 '14 at 10:56
-
@Shiva Then do not add `andorid-support-v7-appcompat` in your build path as its already added in your dependencies. – GrIsHu Mar 27 '14 at 10:59
-
@GrIsHu , i did not get you. Also see this http://www.evernote.com/shard/s283/sh/3f08470f-f38d-4d40-a917-e9e41f995814/0993e814c699718d4f1602ff802388bd – Shashi Shiva L Mar 27 '14 at 11:03
-
I am saying that If dependecies library appears again then just remove your `andorid-support-v7-appcompat` from your build path which you have added. – GrIsHu Mar 27 '14 at 11:05
-
1Just try to change your api level to 4.0 or above and it will not show you this error. – GrIsHu Mar 27 '14 at 11:26
2 Answers
0
Set build target of your project was Android 2.1 (API 7). You have to target Android 4.0 (API 14) at least to get rid of the warning message.
Your app will still run on Android 2.1 devices.

Kanwaljit Singh
- 4,339
- 2
- 18
- 21
-
1
-
i added android:theme="@style/Theme.AppCompat.Light" but not worked. – Shashi Shiva L Mar 27 '14 at 11:48
-
1Check this http://stackoverflow.com/questions/18563441/after-setting-up-android-support-v7-appcompat-r-java-is-missing – Kanwaljit Singh Mar 27 '14 at 12:22
-
Thank you more than 50% of your answer worked for me. problem solved – Shashi Shiva L Mar 28 '14 at 05:03
-
0
As said by @Kanwaljit Singh., Basically values-v14
used for version 14 and above. Finally I found solution.
android:minSdkVersion="8"
android:maxSdkVersion="19"
android:targetSdkVersion="16"
And Project Build target to api-14. Finally clean and build the project. This solved in my case.

Kanwaljit Singh
- 4,339
- 2
- 18
- 21

Shashi Shiva L
- 495
- 11
- 27