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. SD Card File system

Permisi suhu/i,

saya baru beli sd card buat external storage di EVO yg Class 6.

Ini di jadiin fat32 semua ato ada best practice nya ga biar bisa maksimal.



Petra Immanuel


2. cara nyetting AndrOCS Beta di galaxy tab

Salam kenal......

Para suhu, mohon petunjuk utk setting dan activated AndrOCS beta untuk
galaxy tab ? Mohon info application office yg ok, utk galaxy tab. Trims

Best Regards


3. Mod: Undangan untuk Komunitas ID-Android-Dev, Press Release 'IM2 Android Application Contest'


5. Ganti Account di HH

6. Froyo running by 2.6.29?

7. Streaming video