Preparation
-
Create an ndk project
and create a class "HelloWorld.java", the content is as follows
For the convenience of testing, we only need one abi
-
Edit ndk.cpp
-
Simply call
the device will display "ok888" -
Package the project into apk, and decompile to obtain the so file in it
Start modifying the so file
- Use the tool "IDA" to open the so file, and you will find the function we wrote, and the string "ok888" is clearly visible. I heard that
pressing f5 works better!
- Close IDA, use the "010 Editor" tool to open the so file,
flip it up and down and find a very familiar place,
try changing "38" to "55"? Then save (ctrl+s)
and open it with IDA, and found that the string ok888 has changed to "ok88U"
verify
Finally, verify our modification results, replace the original apk file with our modified so file, recompile and sign it, and finally run it. Surprisingly, the screen displays "ok88U"!