首页
社区
课程
招聘
[求助]jni反射调用ActivityThread类的currentActivityThread方法报错
发表于: 2020-12-11 23:29 2942

[求助]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编辑 ,原因:
收藏
免费 0
支持
分享
最新回复 (0)
游客
登录 | 注册 方可回帖
返回
//