Tuesday 6 July 2021

NewGlobalRef called with pending exception java.lang.ClassNotFoundException on different .so

I have a lib my_app.so which uses my_app_helper.so.

The line

jclass jc = env->FindClass("com.my_app.flutter_app.MainActivity");

works perfectly on any place on my_app.so, but gives:

A/zygote64: java_vm_ext.cc:523] JNI DETECTED ERROR IN APPLICATION: JNI 
NewGlobalRef called with pending exception java.lang.ClassNotFoundException: 
Didn't find class "com.my_app.flutter_app.MainActivity" on path: 
DexPathList[[dex file "InMemoryDexFile[cookie=[0, 
547409613216]]"],nativeLibraryDirectories=[/system/lib64, /system/vendor/lib64]]

on my_app_helper.so

My JNI_Onload is on my_app.so, and it passes the JavaVM *vm to my_app_helper.so.

Why it does not find the classes when called from inside my_app_helper.so?



from NewGlobalRef called with pending exception java.lang.ClassNotFoundException on different .so

No comments:

Post a Comment