-2

Possible Duplicate:
No generated R.java file in my project

I am trying to run the project of CyanogenMod / android_packages_apps_Gallery

I download the project from here: https://github.com/CyanogenMod/android_packages_apps_Gallery

Unfortunately, I cannot run it successfully in my emulator. The problem is the R.java cannot be generated. I have tried to 'Project -> clean' the project and delete the gen folder, but it doesn't work.

Any idea? Thanks!

Community
  • 1
  • 1
mobile app Beginner
  • 1,531
  • 3
  • 24
  • 40

3 Answers3

1

Look in all of your res files. If any XML file points to a image, font, or other XML file that doesn't exist, then the R will not get generated. Usually running clean will show an error in one of the XML files, but sometimes not.

kenyu73
  • 661
  • 5
  • 14
1

Sometimes in such cases R.java is re-generated when we delete or add a resource. Try to delete a resource and then add it back.

HT03
  • 320
  • 1
  • 3
  • 10
1

Either your imports are wrong or one of your xml files under the "res" folder has an error. Check the import first. The correct import should be "your package name" followed by ".R" e.g. import com.dhruvg.apps.testapp.R; instead of import android.R;, which is usually automatically imported by eclipse.

Also, check AndroidManifest.xml for the version you're using and create an emulator device which is compatible with that version.

If all else fails, check your project properties under "java build path" and make sure that you're using the libraries correctly. Libraries can clash sometimes.

Dhruv Gairola
  • 8,807
  • 5
  • 37
  • 41