-
Notifications
You must be signed in to change notification settings - Fork 972
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
方法调用方式应该正确,但就是报java.lang.IllegalStateException: obj is null: class android/content/Context #676
Comments
大佬指点迷津啊,抓狂。 |
2.要么就别给null,给个实际点的类。
|
首先感谢回复,第二种方法不可行,补的是安卓上下文环境,是无实际的类,第一方法尝试实现,是直接调用父类AbstractJni的callObjectMethodV,但无结果返回,callObjectMethodV应如何处理。 |
NIEnv->FindClass(com/yxcorp/gifshow/util/CPU) was called from RX@0x4000240c[libcore.so]0x240c |
你可以重载函数callObjectMethodV,使之支持该返回。
其中
总而言之,在实际应用中需要根据你自己的需求自定义,建议通过HOOK等手段获取真机是怎么返回的。 |
public String parseSig(String plainText) {
DvmObject contexts = vm.resolveClass("android/content/Context").newObject(null);
String methodSign = "getClock(Landroid/content/Context;[BI)Ljava/lang/String;";
StringObject obj = sigUtil.callStaticJniMethodObject(emulator, methodSign, contexts, plainText.getBytes(), 1);
return obj.getValue();
}
Find native function Java_com_yxcorp_gifshow_util_CPU_getClock => RX@0x40002030[libcore.so]0x2030
JNIEnv->GetMethodID(java/lang/Class.getName()Ljava/lang/String;) => 0x4a974877 was called from RX@0x40000aa0[libcore.so]0xaa0
[21:39:05 788] WARN [com.github.unidbg.linux.ARM64SyscallHandler] (ARM64SyscallHandler:412) - handleInterrupt intno=2, NR=-130432, svcNumber=0x11f, PC=unidbg@0xfffe0284, LR=RX@0x40000ba4[libcore.so]0xba4, syscall=null
java.lang.IllegalStateException: obj is null: class android/content/Context
at com.github.unidbg.linux.android.dvm.jni.ProxyJni.callObjectMethodV(ProxyJni.java:407)
at com.github.unidbg.linux.android.dvm.DvmMethod.callObjectMethodV(DvmMethod.java:89)
at com.github.unidbg.linux.android.dvm.DalvikVM64$32.handle(DalvikVM64.java:559)
at com.github.unidbg.linux.ARM64SyscallHandler.hook(ARM64SyscallHandler.java:121)
at com.github.unidbg.arm.backend.UnicornBackend$11.hook(UnicornBackend.java:345)
at unicorn.Unicorn$NewHook.onInterrupt(Unicorn.java:128)
at unicorn.Unicorn.emu_start(Native Method)
at com.github.unidbg.arm.backend.UnicornBackend.emu_start(UnicornBackend.java:376)
at com.github.unidbg.AbstractEmulator.emulate(AbstractEmulator.java:378)
at com.github.unidbg.thread.Function64.run(Function64.java:39)
at com.github.unidbg.thread.MainTask.dispatch(MainTask.java:19)
at com.github.unidbg.thread.UniThreadDispatcher.run(UniThreadDispatcher.java:175)
at com.github.unidbg.thread.UniThreadDispatcher.runMainForResult(UniThreadDispatcher.java:99)
at com.github.unidbg.AbstractEmulator.runMainForResult(AbstractEmulator.java:341)
at com.github.unidbg.arm.AbstractARM64Emulator.eFunc(AbstractARM64Emulator.java:262)
at com.github.unidbg.Module.emulateFunction(Module.java:163)
at com.github.unidbg.linux.android.dvm.DvmObject.callJniMethod(DvmObject.java:135)
at com.github.unidbg.linux.android.dvm.DvmClass.callStaticJniMethodObject(DvmClass.java:316)
The text was updated successfully, but these errors were encountered: