-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On 8/18/10 22:34 , Fabrizio Giudici wrote: > > On 8/18/10 12:19 , Roj wrote: >> Hi, Is there any way to change the default location of R.java >> file which is getting created in "gen" folder? By default R.Java >> will get created in gen folder under the package (of the >> application) directory. > >> I have a common code (with UI) which has to go with different >> applications with different package names/branding. When ever I >> change the package name in manifest file, R.java will created >> inside that package so I have to change the import statement in >> all the files with the new location of R. How I can avoid it? >> Also is there is any provision to have two or more R files in >> one application? > There are at least two ways to deal with that - I'm enumerating > them and also taking the chance of asking to the list if there are > some relevant consequences in choosing one or the other. > > 1. You can trick your build system with two AndroidManifest.xml > files. The former has e.g. com.acme.app as the package and thus > com.acme.app.R is generated. Just before you run the packager you > replace/tweak it by changing the package name. This is relatively > simple to do with Maven and is described here: > http://groups.google.com/group/maven-android-developers/browse_thread/thread/56b2449756fd4a40?fwc=1&pli=1 > > - - I suppose you can do the same with ant. > > 2. aapt has got the --rename-manifest-package option that seems > to do the trick as well. Well, after experimenting I've found that #2 is the way to go, at least if you have explicit intents. In fact, if the code packages for activities stays the same, Android will pop up a question box when an explicit intent is activated, asking to choose one of the two apps. This means that the two apps are not well separated.
- -- Fabrizio Giudici - Java Architect, Project Manager Tidalwave s.a.s. - "We make Java work. Everywhere." java.net/blog/fabriziogiudici - www.tidalwave.it/people [email protected] -----BEGIN PGP SIGNATURE----- Version: GnuPG/MacGPG2 v2.0.14 (Darwin) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAkxtTxkACgkQeDweFqgUGxc03QCfbxSLPDG8DQBm0/wYMceYU1+j t64AnR9cPdpAB6nIUdpkFauIMkPqp/qc =fCna -----END PGP SIGNATURE----- -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

