I have the following code in my app:
public static final boolean DEBUG = true;
public static final boolean REL = !DEBUG;
private static final String DEBUG_OR_RELEASE = (REL) ? "RELEASE_VER" : "DEBUG_VER";
I thought that the Java compiler will eliminate the "DEBUG_VER" string completely from the resulting .apk file (when exported via Proguard) but when I examine the .apk file, I see the “DEBUG_VER” string in there.
Why? What am I missing? What did I do wrong?
According to what you posted,
DEBUGis true, soRELis false, so(REL) ? "RELEASE_VER" : "DEBUG_VER"should yield “DEBUG_VER”.This is exactly what you are observing so if you are expecting to see “RELEASE_VER” instead, you should set:
Try that and see what happens.