-
-
[求助]jni反射调用ActivityThread类的currentActivityThread方法报错
-
发表于: 2020-12-11 23:29 2942
-
如题所示,jni通过反射调用ActivityThread类的currentActivityThread方法报错,报错信息如下:
1 2 3 | 2020 - 12 - 12 00 : 07 : 15.658 23995 - 23995 / com.example.soshell A / example.soshel: java_vm_ext.cc: 570 ] JNI DETECTED ERROR IN APPLICATION: can't call static android.app.ActivityThread android.app.ActivityThread.currentActivityThread() with class java.lang.Class<com.example.soshell.soshellNativeMethod> 2020 - 12 - 12 00 : 07 : 15.658 23995 - 23995 / com.example.soshell A / example.soshel: java_vm_ext.cc: 570 ] in call to CallStaticObjectMethod 2020 - 12 - 12 00 : 07 : 15.659 23995 - 23995 / com.example.soshell A / example.soshel: java_vm_ext.cc: 570 ] from void com.example.soshell.soshellNativeMethod.loadclassloader() |
报错处代码如下:
1 2 3 4 5 6 | jclass classz = ( * env) - >FindClass(env, "android/app/ActivityThread" ); LOGI( "FindClass Function Success" ); jmethodID methodz = ( * env) - >GetStaticMethodID(env,classz, "currentActivityThread" , "()Landroid/app/ActivityThread;" ); LOGI( "GetStaticMethodID Function Success" ); jobject obj = ( * env) - >CallStaticObjectMethod(env,jc,methodz); LOGI( "CallStaticObjectMethod Function Success" ); |
前面都没问题,就调用CallStaticObjectMethod
函数这报错了,求助一下大佬们这怎么解决啊
[培训]内核驱动高级班,冲击BAT一流互联网大厂工作,每周日13:00-18:00直播授课
最后于 2020-12-12 00:08
被windy_ll编辑
,原因:
赞赏
他的文章
看原图
赞赏
雪币:
留言: