3

I was impressed by the way android creates an R class during development. I do my development in Android Studio (which basically is a tuned IntelliJ version). Whenever I add a resource, in a matter of seconds the R class is updated with new fields.

When I develop in my plain old java projects, I am having the same desires. Instead of creating many public static final String declarations. I would like to have something like the dynamicly created R class. For obvious reasons of course: less chance on typos.

I started to wonder how they achieved this, because just like in Android development, I have a java project with many resources (i.e. String declarations) in custom XML files. I would love to setup something which processes my custom XML files and creates a dynamic class during development.

The javadoc of Android's generated R class reveals that it was generated using the AAPT tool. (which stands for Android Asset Packaging Tool). So, I am wondering if something similar exists for plain old java projects.

bvdb
  • 22,839
  • 10
  • 110
  • 123

0 Answers0