Discussion Forums  >  Uncategorized

Replies: 1    Views: 248

tiger
Aspiring developer
Profile
Posts: 121
Reg: Dec 26, 2010
USA
1,210
08/10/11 04:46 PM (14 years ago)

How to Duplicate a 1.4 App for the Android

How do Duplicate a 1.4 App for the Android I needed create new apps for the Android Market but the last thing I wanted to do was create four apps from the beginning. Dreading the option of re-entering everything, by trial and error, I discovered how to duplicate an Android 1.4 app. Most of the information below came from David's previous post, http://www.buzztouch.com/forum/thread.php?tid=1064977EE8677EC52909E9C&status=&searchInput=rename&sortColumn=FT.dateStampUTC&sortUpDown=DESC¤tPage=1&doViews=1 Renaming files and Projects in Eclipse is super bogus but doable. Should take you about :10 minutes and you'll be amazed at how silly they make it. Eclipse calls this 'Refactoring' instead of renaming. The idea is that all the source files (the .java files only) belong to a package and each file has the package name at the top of the file. Basically, there are 4 steps and the little 'red arrows' in Eclipse help you figure out where things aren't quite right yet. 1. Choose a new package name and type it in a text editor so you don't lose it during this process. The package name by default is an ugly unique id for the app from your control panel. a. I kept the original name and put an a, b, c and d behind the 1.4 so it became 1.4a 2. Right-click, command-click (mac) the package name in Eclipse. This is the strange looking com.packagename.com name in the /src folder. It's the 'parent package' for all the code. When the context menu opens, choose Refactor > Rename. Rename it. It will try to update all the package names in your project. It will get most of them but almost always misses a few. 3. Look at each .java file in your project and find the ones with the red arrows. These are the ones Eclipse did not rename. It may be all of them! Open each file and overwrite the package name at the top of the file. Cut-n-paste is fine. a. The best way I found to discover the misses was to clean the re-name app. You will see a red x next to the item which needs to be rename. b. I used find and simply to find all instances of 4 and I put a, b, c or d behind the 4 and saved. If you forget to save you will be reminded and you rerun your app. 4. Open AndroidManifest.xml and change the package name there too. 5. Save. 6. Your new packages will be located in your workspace folder. 7. You must re-do all your setup. 8. I found I can use the same debug key for the new package but I had to generate a new release key for the new package You must do the below to avoid getting errors. 1. On the emulator select home – applications – settings – applications – manage applications – find your application and select it – select uninstall – ok 2. Quit the emulator 3. If you install the app on your android phone you have to use the above steps to delete the app from your android phone too so you don't get error messages 4. Clean your new project by going to the toolbar – select project – select clean 5. Quit Eclipse 6. Leave the applications closed for about a minute or so before re-launching I'm may be leaving a few steps out. Post a message and I will post a reply. Remember, your new package is in your workspace folder. Look inside the new folder – src – com folder.
 
David @ buzztouch
buzztouch Evangelist
Profile
Posts: 6866
Reg: Jan 01, 2010
Monterey, CA
78,840
like
08/12/11 01:34 AM (14 years ago)
Thanks for the post, lots of folks will like this ;-)
 

Login + Screen Name Required to Post

pointerLogin to participate so you can start earning points. Once you're logged in (and have a screen name entered in your profile), you can subscribe to topics, follow users, and start learning how to make apps like the pros.