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?
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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With