Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I install the same Android App .apk twice on the same device?

I have one project in Git that I develop with Eclipse that I need to create a Production ready .apk and a Dev .apk to be installed on the same device.

The change between the two is minor property settings, such as XML feeds, etc.

With or without Eclipse, what is the best practice to create the Producion and Deve .apk files to be installed on the same device?

like image 405
Todd Avatar asked Apr 06 '11 00:04

Todd


2 Answers

The only way I've found to do this is to change the package name. Technically this only has to be done in the manifest file but this will likely cause some build errors so you will probably have to rename the package as well. so if you have com.company.app you might change it to com.company.app.dev and com.company.app.prod. Eclipse should handle all the code renaming for you as long as you aren't using any reflection.

like image 136
skorulis Avatar answered Oct 28 '22 06:10

skorulis


I'm solving this kind of problem in following way:

I have 3 different activities: basic, production and development, like:

public class BasicActivity extends Activity {} //actually conntains all code
public class ProductionActivity extends BasicActivity {} //empty one
public class DevelopmentActivity extends BasicActivity {} //empty one

Then there are 2 different manifests, say: production (points to ProductionActivity as launchable and has different package) and development (points to DevelopmentActivity as launchable)

When I need to start Production one - I used to copy production manifest (with ant task) as real one and vice-versa with development one.

There's small complication with resources compiling since R.class has to be in the same package as declared in manifest. But again with some "handmade" anting I have mamaged to solve this problem also.

like image 33
Barmaley Avatar answered Oct 28 '22 06:10

Barmaley