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",
PackageManager.GET_SIGNATURES);
to test if
appInfo.signatures[0].toCharsString()
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:
 http://developer.android.com/guide/publishing/app-signing.html 
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
this.
Thanks in advance!
Brady
--~--~---------~--~----~------------~-------~--~----~



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
technique:

Config.java:
public class Config {
        public static final String BUILD_NAME = "eclipse";
}

build.xml:
<target name="prepare-full">
  <property name="product" value="full" />
</target>

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

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

This will replace 'BUILD_NAME="eclipse";' with 'BUILD_NAME="full";' in
Config.java 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).

Regards,
Pieter.



--~--~---------~--~----~------------~-------~--~----~


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?

Cheers,
Brady




--~--~---------~--~----~------------~-------~--~----~



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.

Mkasih

-- 
Rgds,

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
=DN=

-- 
===============
"

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

4. MOTOROLA DROID X Atau HTC Evo 4G

5. Ganti Account di HH

6. Froyo running by 2.6.29?

7. Streaming video