There does seem to be a real problem with the order in which the build
steps occur, so that R.java is sometimes not created before it is
needed during the build process.

I have an application which has both a free and paid version available
in the Android market.  I build both versions from the same source
code base.  To do this I have to use two different package names
because the Android market requires this.  My application always uses
a single java package name, but I switch between two package names in
the Android manifest file where I add either Lite or Pro to the end of
the Java package name.  I have explicit import statements for the
specific "build package name".R in all the files and use Eclipse to
refactor this import when I shift which version I am building.  This
entire process usually works just fine, however once in a while it
exposes the problem in the build ordering where R.java is not created
when it should be.

I always follow these steps:
1) Turn off automatic builds
2) Change the Android Manifest file package name
3) Manually refactor the imports for R
4) Do a build clean
5) Turn back on automatic builds

I have noticed that if I let too much time elapse between steps 4 and
5, or if I use a manual build rather than an automatic build to build
after the clean, then often it will have problems building because it
cannot find R.java during the build, which it reports as a build path
issue.  When this occurs I still haven't found a simple way to get
around this build issue and each time it happens I have to fiddle
around by changing something in the build path ordering hoping it will
restart the build process or exit and restart eclipse hoping it will
restart the build process and create the missing R.java file.

I think this same problem is easily replicated without the added
complexity of multiple package names.  All you need to do is:

1) Do a project clean
2) Wait a little while
3) Then do a manual build instead of an automatic build.

Try this a few times and you will see that sometimes it fails to build
R.java before it is needed by the other steps in the build process.

-- 
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.

NEW! Try asking and tagging your question on Stack Overflow at
http://stackoverflow.com/questions/tagged/android

To unsubscribe from this group, send email to
android-beginners+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en

Reply via email to