Monday, April 8, 2013

[android-developers] Re: How to compile APK using different constant

Changing a value implies that it's not correct to implement these as constants.

that's not true in all circumstances... Sometimes you'd want specific code to not even compile and be present in the APK. Using constants and replacing their values in the build script makes it very easy to create multiple APKs (which is something event a single market supports) with specific code bases (in his case, why the hell would he need code that meant to work with Samsung's market in the Google market build?). I think the biggest example is app logging and debug information code - No point of using a dynamic variable for those, that code is useless and sometimes it event affects performance.

Java is missing the #if fun of C :)
 

On Sunday, April 7, 2013 10:27:14 PM UTC+3, Lew wrote:
Giuseppe wrote:
I have a Consant.java file that manage few static variable for different store:

static private boolean isForGoogleMarket = true;
static private boolean isForOperaMarket = false;
static private boolean isForTStoreMarket = false;
static private boolean isForAmazonMarket = false;
static private boolean isForSamsungMarket = false;
static private boolean isForAndroidPitMarket = false;

When I compile the APK for each market, I need to change the value of the const above.

Changing a value implies that it's not correct to implement these as constants.

You probably should go for a resource-based approach.

  private static final boolean FOR_GOOGLE_MARKET = R.bool.forMarket;

etc.

The real question is how you're determining what your "market" is in the first place. Tell us that, please.
 
I am looking for a solution to build each apk for each market changing the constant automatically.

Probably Marven config can be the solution, but I really don't know how to do


Android comes with built-in tools to manage app variations between markets. They're called resources.


-- 
Lew

--
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
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 unsubscribe from this group and stop receiving emails from it, send an email to android-developers+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate