1

I have an Android project in Eclipse. There is a folder called "gen [Generated Java Files]". Where does this folder come from? How can I control what is generated here? Is there any documentation for this somewhere? I have tried to change and replace the code and files in this gen folder, but I cannot seem to change anything. Every time I change something, as soon as I save, the files revert back.

user840930
  • 5,214
  • 21
  • 65
  • 94

3 Answers3

0

All this is handled automatically - in the very firt row of the R-class you can see the comment:

/ AUTO-GENERATED FILE. DO NOT MODIFY*

Whatever resources you put in the project - it will automatically be put in the R-class

For instance - if you put a soundfile in your project and make a reference to it in xml, a static field of this resource will automatically be generated in the R-class:

  public static final int mysound = 0x7f05004d;
Björn Hallström
  • 3,775
  • 9
  • 39
  • 50
0

R.java is a special dynamically generated class, created during the build process to dynamically identify all of the assets (from strings to android widgets to layouts) in your Android app.

You specify these in XML. Take a look at these links and see if they helps you. Someone may be able to flesh out this answer a bit more and I welcome any help to make it better.

Accessing Resources

Providing REsources

clyde
  • 824
  • 9
  • 18
0

R.java is a file autogenerated on build. It's content is based on the resource files, for example layouts, drawables, styles, preferences, etc., and have all the resources ID's provided to the resource files.

When you deleted it, it was recreated with all the ID´s provided to resources.

Jorgesys
  • 124,308
  • 23
  • 334
  • 268