0

I was looking for a solution in my Android project, and I still could not resolve that. It's about my R class that disappeared from my project, then I was looking for possible solutions like, clean the project, look for errors in my XML files (but there is no error, neither a warning).

I refreshed my project, build my project and and many other steps.

The errors are like "R cannot be resolved to a type" in all my Java codes.

halfer
  • 19,824
  • 17
  • 99
  • 186
  • 2
    have you checked other questions on SO? there are hundreds of them. almost the same questions. like: http://stackoverflow.com/questions/5298231/r-cannot-be-resolved?rq=1 – benka Nov 21 '13 at 15:14

3 Answers3

0

I faced the same issue before. Changing the project target inside the project.properties file worked for me. For example I changed my project target to 15 from 18 and the R.java file appeared. Here goes the content of my project.properties file:

# This file is automatically generated by Android Tools.
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
#
# This file must be checked in Version Control Systems.
#
# To customize properties used by the Ant build system edit
# "ant.properties", and override values to adapt the script to your
# project structure.
#
# To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home):
#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt

# Project target.
target=android-15
Md. Arafat Al Mahmud
  • 3,124
  • 5
  • 35
  • 66
0

The project won't build if you have error in your ressource. So check if you have any errors in a layout/value/drawable file...

Timothy T.
  • 602
  • 4
  • 10
0

Check if any image in the drawable folder starts with a number or a symbol.

Check the console and error log window. See that if it is showing any error in read.

Right Click project ->Android Tools -> Fix project Properties

Right Click Project ->Build Path ->Configure Build Path . Go Here Then go to the Libraries Check. See if any library has a red cross. If yes then remove it In the same window, go to the Order and Export Tab-> Tick Mark all the entries.

Check that none of your reference start with a number.

Restart Eclipse, Refresh Project Then Clean it and Run it

Rahul Gupta
  • 5,275
  • 8
  • 35
  • 66