-
Notifications
You must be signed in to change notification settings - Fork 74
Open
Description
I'm experiencing an issue where my native library loads correctly via JNI_OnLoad but the BNM (ByNameModding) initialization doesn't complete properly on real Android devices (Rooted) when using KittyInjector for injection. The same setup works perfectly on emulators (tested with MuMuPlayer).
Setup
- Injection Method: KittyInjector
- Library: Using BNM with
JNI_OnLoad - Environment:
- Emulator (MuMuPlayer) → ✅ Works fine (BNM loads and logs appear)
- Real Devices → ❌ Only shows
ByNameModding: JNI_OnLoad, no further logs
Code (JNI_OnLoad)
JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM *vm, [[maybe_unused]] void *reserved) {
JNIEnv *env;
vm->GetEnv((void **) &env, JNI_VERSION_1_6);
try {
BNM::Loading::AllowLateInitHook();
// Load BNM by finding the path to libil2cpp.so
BNM::Loading::TryLoadByJNI(env);
BNM::Loading::AddOnLoadedEvent(initializeUnityHooks);
} catch (const std::exception &e) {
LOGE("JNI_Exception in BNM loading: %s", e.what());
return JNI_ERR;
}
BNM_LOG_INFO("JNI_OnLoad");
return JNI_VERSION_1_6;
}Logs
Emulator (working case):
ByNameModding: [SetupBNM] il2cpp::vm::Class::Init in lib: 0x1c69d54.
ByNameModding: [SetupBNM] code has il2cpp_image_get_class. BNM will use it.
ByNameModding: [SetupBNM] il2cpp::vm::Class::FromIl2CppType in lib: 0x1c698ac.
ByNameModding: [SetupBNM] il2cpp::vm::Type::GetClassOrElementClass in lib: 0x1cc21bReal Device (failing case):
ByNameModding: JNI_OnLoadAdditional Notes
If I load the library with smali code, it works correctly on both emulator and real devices.
This issue only happens with KittyInjector on real devices (Rooted).
Metadata
Metadata
Assignees
Labels
No labels