Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to read .so file in Android?

Tags:

android

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.

like image 712
Himanshu Dudhat Avatar asked Jun 07 '11 06:06

Himanshu Dudhat


People also ask

Can .so files be read?

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.

What is .so file in Android?

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.

How do I open a shared library file?

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).


1 Answers

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;
}
like image 168
Jaydeep Khamar Avatar answered Sep 25 '22 15:09

Jaydeep Khamar