Android 4.2 - LD_PRELOAD supported or not?

谁都会走 提交于 2019-12-06 02:30:27

Generally speaking, LD_LIBRARY_PATH has worked on engineering builds (a.k.a. rooted devices) for quite a while. The problem is that this does not help for production builds - not because the loader is changed, but because the environment for your app is secured.

Although the offical NDK-r9d documentation still says the same, but it turns out that LD_PRELOAD does work on rooted devices. Run

adb shell
setprop wrap.com.xyz.yourapp LD_PRELOAD=/path/to/your/library.so
stop
start

after pushing the library to the device. I tried it successfully on ANDROID-19 emulator to provide alternate definition of a function.

Check out this link - http://cedricvb.be/post/intercepting-android-native-library-calls/

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!