Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make Android app automatically configure w/ debug vs. release values?

I'm working on an Android app, specifically one that uses the Facebook Android SDK. In development mode, I'm working with a test Facebook app that goes by one ID. However, in release mode, the app will be working with second Facebook app with a different ID.

I'm wondering how most Android (or Java might be a suitable enough realm of knowledge) developers here go about having their app automatically build with debug vs. release values. An ideal solution does not involve a manual switch (e.g.: switching public static final DEBUG = false; to true) before building.

like image 598
Matt Huggins Avatar asked Nov 29 '22 17:11

Matt Huggins


2 Answers

It's been a while since you asked but I thought I'd share how I'm doing it.

Like Sebastian hinted, an Ant script can handle that change for you and generate the static final constants that you're looking for. You can configure IntelliJ or Eclipse to make it almost seamless.

I tried to detail the different steps I took over here, let me know if it helps. I know I never have to make any manual changes before releasing, and it's a nice relief!

like image 108
Romain Avatar answered Dec 02 '22 07:12

Romain


In eclipse ADT 17.0 and above there is a new feature for this. Check the BuildConfig.DEBUG that is automatically built with your code.

For more information see http://developer.android.com/sdk/eclipse-adt.html

like image 36
mach Avatar answered Dec 02 '22 07:12

mach