What is all this renaming nonsense?
Real programmers just type their code in again, with the new package
names, from memory, with their eyes closed!
:)
08.12.2011 13:57, Mukesh Srivastav ?????:
Pretty simple, if you use Eclipse as Development Enviorment.
You just have to select the project root in the Eclipse and Rename
it,Eclipse will automatically update the reference of the package.
Warm Regards,
*Mukesh Kumar*,
Android Consultant/Freelancer,
India,Hyderabad.
On Thu, Dec 8, 2011 at 3:18 PM, Daniele Segato
<[email protected] <mailto:[email protected]>> wrote:
On 12/04/2011 05:43 AM, bob wrote:
Let's say you have an Android game. You want to duplicate the
project
and change the package name to make a new game. Is there a
simple 20-
second way of doing this? I've tried many methods and somehow
this
always takes about half an hour of fiddling for something that
ought
to be trivial.
it should be easily done with some unix shell command:
1. copy the project
# now move the directory
2. mv src/old/package/position src/new/package/position
# change the "package" inside java sources
3. sed -i 's#^package old\.package\.position#package
new.package.position#' `grep -Rl '^package old\.package\.position'
src/*`
# change the imports inside java sources
4. sed -i 's#^import old\.package\.position#import
new\.package\.position#' `grep -Rl '^package
old\.package\.position' src/*`
# if you have defined custom view change the tags
5. sed -i
's#<\(\/?\)old\.package\.position#<\1new\.package\.position#g'
`grep -Rl 'old\.package\.position' res/layout*/*`
6. finally manually fix your manifest, or using a command like the
one above
I also suggest to use a versioning tool like git and check the
diff at each step, committing if it's correct or
resetting/cleaning if you did a mistake... at the end you can
squash the commits to be a single one with rebase interactive or
if you rename the package on a branch (suggested) just merge your
branch with the --squash option back in mainline
if you still don't know them run learn regex and unix shell :)
on a mac (or bsd) the above sed commands should be rewritten with:
sed -i '' 's#....#....#'
note the double quote after -i
if you are on Windows well... :) enjoy doing it manually with
Eclipse, it may help you a little but it will take you some time
and probably some head ache ;)
cheers
--
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]
<mailto:[email protected]>
To unsubscribe from this group, send email to
[email protected]
<mailto:android-developers%[email protected]>
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
--
--
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
--
Kostya Vasilyev
--
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