Debug mode vs. Release mode

by Brady » Fri, 04 Sep 2009 01:46:07 GMT

Sponsored Links
 Hi everyone,

I'm trying to figure out a way to programmatically determine if my
build was built in debug mode vs. release mode. I'd like to hide some
items in my settings screen if it's release.

When I build my app in Eclipse I'm building by default in Debug mode.
However, when I build the app using the command line, I build it in
release mode and sign the app using the jarsigner tool.

I've tried using
PackageInfo appInfo = manager.getPackageInfo("com.adobe.psmobile",
to test if
matches my debug signature and that didn't seem to work.

I'm now trying to see if I can introspect the app's KeyStore, to match
the default debug alias described here: 
of "androiddebugkey"

but I haven't figured out how to retrieve the app's KeyStore yet.

I'd greatly appreciate it if anyone had any suggestions on how to do
Thanks in advance!

Debug mode vs. Release mode

by Pieter » Fri, 04 Sep 2009 13:25:48 GMT

 Hello Brady,

I don't know if this is what you are looking for, but if you use
ant to build your release version you could use the following
public class Config {
        public static final String BUILD_NAME = "eclipse";

<target name="prepare-full">
  <property name="product" value="full" />

<target name="gather-sources">
<copy todir="${sources}">
  <fileset dir="${srcdir}">
    <include name="com/spectrekking/" />
  <filterset recurse="false" begintoken="BUILD_NAME = &quot;"
    <filter token="eclipse" value="BUILD_NAME = &quot;${product}

<target name="build-full" depends="prepare-full,gather-sources,..."/>

This will replace 'BUILD_NAME="eclipse";' with 'BUILD_NAME="full";' in during
a production build, allowing you to easily check the version. This
technique can then also
be used to differentiate between full and light builds (and in our
case the adc2 version).



Sponsored Links

Debug mode vs. Release mode

by Andrei » Sat, 05 Sep 2009 10:32:19 GMT

 how about android.util.Config.RELEASE?


Debug mode vs. Release mode

by Brady » Sun, 06 Sep 2009 08:26:13 GMT

 Hi Peter,

thank you for the suggestion. Yes we are using ant. We already use
some scripting like that to update a build java src. I'm not sure if
we'd add that to the build.xml (because it's autogenerated) but we
could update a static like you suggest.

Any ideas if we can compare the debug key vs. release?



Debug mode vs. Release mode

by Brady » Sun, 06 Sep 2009 08:29:17 GMT

 Sorry, I misspelled your name. Thank you Pieter!

Debug mode vs. Release mode

by Andrei » Sun, 06 Sep 2009 10:14:40 GMT

 can you use Config.DEBUG?


Other Threads

1. Canada... anyone got a story?


I'm in Montreal and I've gotten into developing for Android as I
believe the open source-ness and Java base will truly help it win over
the "other guys" closed nature in the long run.

My problem is I can't find an android phone WITH a data package in
Canada (I don't care if it's outside Quebec)

I've scoured this group and the net but haven't seen anything other
than getting a Rogers account, signing up for the iPhone data plan,
unlocking my Android and slapping the sim from my Rogers iPhone
account / phone into the Android and hoping to get G1 service.

Yeah sure I can use the device emulator for now but I'd love to have
my own phone sporting my own apps. :)

Two questions:

1. Is this still the only way to do this?
2. Are there ANY plans for someone to bring the Android to us in the
Great White North?



2. How to include TelephonyProvider in SDK release

I can find the TelephonyProvider in source code, But it is not
released in the SDK release 1.0. How can I build it myself with "mame
sdk"? Some compile configuration? Anyone tried it before? Thanks in

3. What's the meanin of WakeType defined in RIL.Cpp

4. disable home button

5. A question about camera of Android SDK 1.0 rc2

6. managedQuery() terminating the application.

7. recommendaed packages/classes to learn about?