FORUMS

Top Forum Discussions

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

44 posts
Thanks Meter: 185
 
Post Reply Subscribe to Thread Email Thread
6th January 2015, 09:54 PM |#31  
bluflight's Avatar
Senior Member
Thanks Meter: 757
 
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,955
 
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 2 Users Say Thank You to _that For This Useful Post: [ View ]
26th August 2015, 06:53 AM |#33  
wladimir_tm's Avatar
Member
Thanks Meter: 40
 
More
addit. maybe interesting for someone too: http://forum.xda-developers.com/show....php?t=2794413
---- find out some addit dependencies.
The Following User Says Thank You to wladimir_tm For This Useful Post: [ View ]
Post Reply Subscribe to Thread
Previous Thread Next Thread
Thread Tools
Display Modes