I decoded an .dex to smali using apktool, but I couldn't find a way to edit DEBUG, a boolean defaulted to false (reading 0x0000000 in Java Bytecode Editor), to always return true. I've attempted to edit the 0x0000000 field directly via JBE, recaf, and HxD, but the program either can't edit a boolean field (JBE and recaf) or won't recognoze the .class after hex editing.
Any help, whether it's about how to change the .smali code or .class code, will be greatly appreciated.
.class public final Lcom/rockstargames/gtactw/BuildConfig;
.super Ljava/lang/Object;
.source "BuildConfig.java"
# static fields
.field public static final DEBUG:Z
# direct methods
.method public constructor <init>()V
.locals 0
.prologue
.line 4
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
return-void
.end method
JD GUI simply read the above code as
package com.rockstargames.gtactw;
public final class BuildConfig {
public static final boolean DEBUG = false;
}
The java compiler will usually inline references to static final fields at compile time. So even if you change the value of the field, it won't actually affect anything, typically.
Instead, you would need to modify the value at the point(s) where it was actually used, in the original code. Unfortunately, it's not easy to determine where that is now. Because after the compiler inlined the value, it will just be something like const v0, false