LSPosed / XposedUnitTest

4 stars 6 forks source link

native_init is not invoked #2

Closed ghost closed 3 years ago

ghost commented 3 years ago

I'm testing the native api, but when the so is loaded the function native_init is not invoked. The so is not a JNI library, but I don't understand as the so is initliatized.

logcat | grep LSP 
03-14 08:05:12.318  7113  7113 I LSPosed : Start to install inline hooks
03-14 08:05:12.319  7113  7113 I LSPosed : Using api level 27
03-14 08:05:12.319  7113  7113 I LSPosed : Start to install Riru hook
03-14 08:05:12.319  7113  7113 I LSPosed : Riru hooks installed
03-14 08:05:12.319  7113  7113 I LSPosed : ART hooks installed
03-14 08:05:12.524  7113  7113 I LSPosed : Loading modules for io.github.lsposed.unittest
03-14 08:05:12.525  7113  7113 I LSPosed-Bridge: Loading modules from /data/app/io.github.lsposed.unittest-u0_wcbLvW-XyOSiRiBS44A==/base.apk
03-14 08:05:12.536  7113  7113 I LSPosed-Bridge:   Loading class io.github.lsposed.unittest.HookMain
03-14 08:05:12.628  7113  7113 W LSPosed : New modules detected, hook preferences
03-14 08:05:12.649  7113  7113 I LSPosed-Bridge: handleLoadPackage io.github.lsposed.unittest
03-14 08:05:12.652  7113  7113 I LSPosed-Bridge: Injecting into self...
03-14 08:05:12.653  7113  7113 I LSPosed-Bridge: done

LSPTest don't appear in log. No exception in System.loadLibrary. I added a print but nothing.

extern "C" __attribute__((visibility("default"))) void native_init(void* init) {
    LOGI("native_init");

I compiled with NDK 21.1 and 22.0 but nothing is changed. Hook on staticTest is working.

My environment is Android 8.1 x86 Magisk 22 LSPosed 1.2.2 LSPosed modules: only XposedUnitTest Magisk Modules: Riru Core, LSPosed

yujincheng08 commented 3 years ago

Did u add so name to the corresponding asset file?

ghost commented 3 years ago

@yujincheng08 no I maked assets/xposed_init and I write only class name Is there a new asset file?

From native_api.cpp I found assets/native_init I will try.

ghost commented 3 years ago

I maked file assets/native_init and I wrote the row liblsposed_module.so, the library is not initiliazed. I will try with LSPosed debug version

ghost commented 3 years ago

I moved the System.loadLibrary from HookMain in MainActivity and the native_init is invoked. I don't know if the cause of this issue is the architecture x86. I can't test on arm I have only an Android 8.0