WeChatHook Build Pitfalls — How Hermes Killed Tablet Login
Root Cause Chain (2026-07-03)
Three mistakes, stacked together, caused WeChat tablet login to completely disappear:
1. Wrong XposedBridge JAR → All Hooks NoSuchMethodError
What Hermes did: Recompiled WeChatHook.java with standard XposedBridgeApi.jar
Why it broke: LSPosed Vector (JingMatrix fork) provides its own obfuscated XposedHelpers at runtime with package lwhVNgqLnt.mxUMcgFJoCZ.XposedHelpers. Standard XposedBridgeApi.jar compiles against the original unobfuscated API. At runtime, every findAndHookMethod() call throws NoSuchMethodError because the method signatures don't match.
Result: ALL hooks failed silently. No error visible in LSPosed daemon logs (JingMatrix Vector doesn't log module errors), only discoverable via:
su -c 'grep "NoSuchMethod" /data/adb/lspd/log/modules_*.log'
Correct approach:
- On Mac: use
/tmp/LSPosed/legacy/build/intermediates/compile_library_classes_jar/release/bundleLibCompileToJarRelease/classes.jar - If correct JAR unavailable: extract DEX from a previously working APK instead of recompiling
2. xposed_init at Wrong Location → Daemon Deletes Module
What Hermes did: Packaged xposed_init at APK root
Why it broke: LSPosed daemon validates assets/xposed_init (inside APK's assets/ directory) on EVERY startup. Root-level xposed_init is ignored. Validation failure → daemon auto-deletes the module entry from modules_config.db. Even manual DB restoration gets rolled back on next restart because the APK still lacks the correct file.
Correct:
zip APK.apk assets/xposed_init ...
Content: com.example.wechathook.WeChatHook
Wrong:
zip APK.apk xposed_init ...
3. Keystore Mismatch → Install Rejected
What Hermes did: Signed APK with a different keystore
Why it broke: Android's package manager rejects updates signed with a different certificate with INSTALL_FAILED_UPDATE_INCOMPATIBLE. Forced uninstall → LSPosed DB registration lost → even after reinstalling, module isn't registered.
Correct: Always sign with ~/.android/debug.keystore (CN=Android Debug,O=Android,C=US)
Additional Hazard: send_wechat_message_ui Force-Stops WeChat
~/pixelphone/event_bus/wechat_send.py line 363:
_run("am force-stop com.tencent.mm", timeout=10)
Every call to mcp_android_phone_send_wechat_message force-stops WeChat before sending. This kills the tablet login session every time. Only use with user confirmation when tablet login is active.
Fix Applied (2026-07-04)
- Extracted DEX from original correctly-compiled
wechathook_v2_signed.apk(bypasses JAR issue) - Repacked with correct
assets/xposed_init - Signed with
~/.android/debug.keystore - Rebuilt LSPosed DB registration (mid=42, scope=com.tencent.mm)
- Rebooted to apply
Verified State (2026-07-04)
| Item | Value |
|---|---|
| APK | com.example.wechathook (versionCode=1) |
| Sign | ~/.android/debug.keystore |
| LSPosed mid | 42 |
| Scope | (42, com.tencent.mm, 0) |
| enabled | 1 |
| Good DEX source | wechathook_v2_signed.apk |
| Reference | /sdcard/wechathook/do_not_break.md |