2 Answers2

2

Android R.java is an auto-generated file by aapt (Android Asset Packaging Tool) that contains resource IDs for all the resources of res/ directory.

Clean-Rebuild-Remove gen Folder-Restart

  • If you somehow hit something and created import android.R in your activity, remove it.
  • Run Project -> Clean. This will delete and regenerate R and BuildConfig.
  • Make sure Project -> Build Automatically is ticked. If not, build it manually via Menu -> Project -> Build Project .

Developing for Android in Eclipse: R.java not regenerating

Community
  • 1
  • 1
IntelliJ Amiya
  • 74,896
  • 15
  • 165
  • 198
1

R.java is auto generated code. Please delete your gen (in eclipse) folder and try re-build the app.

Zumry Mohamed
  • 9,318
  • 5
  • 46
  • 51
  • i watched tutorials and in those tutorials R.java file was not as long as my eclipse generates. – cute programmer Dec 23 '15 at 07:40
  • What are the tutorials ? R.java file keep resource related information. once the resouces changes it will re-generate with changes. There are two kind of R files . Android has a inbuilt R file for their ids. – Zumry Mohamed Dec 23 '15 at 07:43