FORUMS

SuperSU Beta Updates With Minor Fix For Galaxy S6

ChainFire’s root permissions app SuperSU has updated to v.2.49 to fix audits on … more

LG G4 Day Event Coverage: Specs, Features, Design & More!

LG has been teasing us with a countdown for a while now, and today it reached … more

Xposed Modules to Modify Email – XDA Xposed Tuesday

Even though we have Dropbox and other ways to share files, people still want … more

Google Teaches You to Use Wear Gestures

Now that the Watch Urbane is out with the latest firmware, we have new information regarding the … more
Post Reply Subscribe to Thread Email Thread

[TUTORIAL] Find out which shared libs (.so) are missing

6th January 2015, 09:54 PM |#31  
bluflight's Avatar
Senior Member
Thanks Meter: 737
 
More
Quote:
Originally Posted by _that

For finding native library dependencies of apks, you need to decompile them, search the smali files for invokes of "loadLibrary" and trace the argument back to the string constant (usually it's just a few lines above the loadLibrary call). Prepend "lib" to the string constant and append ".so", that's the name of the required native library.

An example could look like this:

Code:
    const-string v0, "defcontainer_jni"
    invoke-static {v0}, Ljava/lang/System;->loadLibrary(Ljava/lang/String;)V
So we know that this app requires libdefcontainer_jni.so.

Many thanks mate, you do not know how long I was looking for this so I imagine that if I do not find in Smali invoke of loadLibrary mean this app not need/create any .so file when installed, right?
 
 
6th January 2015, 11:32 PM |#32  
Recognized Contributor
Thanks Meter: 2,738
 
More
Quote:
Originally Posted by bluflight

Many thanks mate, you do not know how long I was looking for this so I imagine that if I do not find in Smali invoke of loadLibrary mean this app not need/create any .so file when installed, right?

If it's not a system app, the apk will contain all required libraries anyway, so you just need to look what's inside the apk. For system apps it's different, because all their shared libraries are mixed together in /system/lib. For both system and non-system apps, the native libraries need to be loaded somehow from the compiled Java code, and I think there is no other way than calling loadLibrary. So, yes, if there is no loadLibrary call, the app doesn't use any native libraries. Or it uses an unknown mechanism to load them.

Not directly related to your apk question, but related to the topic of this thread:
I've recently written a script to check native dynamic library dependencies. It does not only check which libraries are needed, but also if those libraries are compatible and if all unresolved symbols are resolved, and which symbols are used from which library. Very useful for porting ROMs onto older proprietary HAL libraries or for porting stock system apps to different ROMs. If there is interest, I'm going to release it in a separate thread with some documentation. If you need it already now, look for "ldcheck" in my github.
The Following User Says Thank You to _that For This Useful Post: [ View ]
Post Reply Subscribe to Thread
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes