YAHFA icon indicating copy to clipboard operation
YAHFA copied to clipboard

hook 常量

Open z8806c opened this issue 5 years ago • 3 comments

android.os.Build

public static final String MODEL = getString("ro.product.model");

静态常量可以hook吗

z8806c avatar Mar 18 '19 06:03 z8806c

常量为什么不用反射要用hook呢

icefoggy avatar May 11 '19 09:05 icefoggy

static final variables are inlined by compiler and their references are automatically replaced with a value they hold everywhere they are used so they basically do not exist at runtime and thus changing them has no effect. You have to find a different strategy. E.g. hook method where such constant is used.

C3C0 avatar May 13 '19 05:05 C3C0

用反射 https://github.com/rk700/YAHFA/issues/12

rk700 avatar May 24 '19 00:05 rk700