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. Layout Problem in different screen size

I have a linearlayout below, i want something similar to
android:layout_width="30%"
does anyone know that?

<LinearLayout
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    >
    <TextView
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:id="@+id/tv1"
        android:textColor="#FFFFFF"
        />
    <TextView
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:id="@+id/tv2"
        android:textColor="#FFFFFF"
        />
    <TextView
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:id="@+id/tv3"
        android:textColor="#FFFFFF"
        />
  </LinearLayout>

-- 

2. How to make this layout in programming?

I have a layout xml . I would like to do that in java programming.
Can anybody help me?

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
  xmlns:android="http://schemas.android.com/apk/res/android"
  android:layout_width="fill_parent"
  android:layout_height="wrap_content"
  android:id="@+id/rl">

  <TextView
    android:id="@+id/tv1"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentRight="true"
    android:layout_centerVertical="true"
    android:textColor="#FFFFFF"
    />
  <LinearLayout
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_toLeftOf="@id/tv1"
    >
    <TextView
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:id="@+id/tv1"
        android:textColor="#FFFFFF"
        />
    <TextView
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:id="@+id/tv2"
        android:textColor="#FFFFFF"
        />
    <TextView
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:id="@+id/tv3"
        android:textColor="#FFFFFF"
        />
  </LinearLayout>
</RelativeLayout>

-- 

3. Sending Email

4. Regarding Storing of data in the database in android.

5. Code of Home Screen

6. Android USB adb device not being enumerated.

7. A Question regarding Android system preferences: Settings.Secure