How do I import and use an .SO
file that I extracted from apk
file?
I've used ctypes library in Linux but it gave me error on every way I tried it.
There are 2 version of the .so
files: arm64, and armeabi.
When i tried import the armeabi version, which is 32-bit, it gave me
wrong ELF class: ELFCLASS32
and so I try the arm64, and somehow I got
cannot open shared object file: No such file or directory
I can assure you it is not a typo path, I tried to copy it using the same path. but I cannot import it because no such file.
code:
import ctypes
def main():
TestLib = ctypes.CDLL('/home/manalkaff/Desktop/arm64-v8a/nativelibrary.so')
if __name__ == '__main__':
main()
Is this how I am supposed to do it? Or there is another way?
You can't load and execute ARM code on x86 CPU. You need a virtual machine that will emulate ARM CPU for that.
Even after loading the .so
file on Linux ARM, you might still be missing some Android dependencies. Use ldd copied.so
to see which.