From 9bc252dd65372c621a0db1455f5e5be5c9e73d45 Mon Sep 17 00:00:00 2001 From: tiann Date: Sat, 24 Jul 2021 14:17:31 +0800 Subject: [PATCH] Fix unseal not working when proguard enabled. Signed-off-by: tiann --- library/src/main/java/me/weishu/reflection/Reflection.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/library/src/main/java/me/weishu/reflection/Reflection.java b/library/src/main/java/me/weishu/reflection/Reflection.java index fb6ca71..9161812 100644 --- a/library/src/main/java/me/weishu/reflection/Reflection.java +++ b/library/src/main/java/me/weishu/reflection/Reflection.java @@ -56,7 +56,9 @@ private static boolean unsealByDexFile(Context context) { } DexFile dexFile = new DexFile(code); - Class bootstrapClass = dexFile.loadClass(BootstrapClass.class.getCanonicalName(), null); + // This class is hardcoded in the dex, Don't use BootstrapClass.class to reference it + // it maybe obfuscated!! + Class bootstrapClass = dexFile.loadClass("me.weishu.reflection.BootstrapClass", null); Method exemptAll = bootstrapClass.getDeclaredMethod("exemptAll"); return (boolean) exemptAll.invoke(null); } catch (Throwable e) {