I am new to Android and I have one project which contains an .so
file. In one .java
file, this lib is used and I want to read that .so
file.
SO files can technically be opened with GNU Compiler Collection but these types of files aren't intended to be viewed or used like you might another type of file. Instead, they're just placed in an appropriate folder and used automatically by other programs via Linux's dynamic link loader.
The SO file stands for Shared Library. You compile all C++ code into the.SO file when you write it in C or C++. The SO file is a shared object library that may be dynamically loaded during Android runtime. Library files are larger, often ranging from 2MB to 10MB in size.
If you want to open a shared-library file, you would open it like any other binary file -- with a hex-editor (also called a binary-editor). There are several hex-editors in the standard repositories such as GHex (https://packages.ubuntu.com/xenial/ghex) or Bless (https://packages.ubuntu.com/xenial/bless).
You will have to put the .so file in the lib folder. Then access it using the demo function as shown below:
public static boolean loadNativeLibrary() {
try {
Log.i(TAG, "Attempting to load library: " + LIBRARY_NAME);
System.loadLibrary(LIBRARY_NAME);
} catch (Exception e) {
Log.i(TAG, "Exception loading native library: " + e.toString());
return false;
}
return true;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With