FORUMS

Android 5.1.1 Omni ROM For Motorola Xoom

Back in Feb 2011, the Motorola Xoom became the first device to be sold with Android 3.0 … more

CleanSlate Brings Fingerprint Scanner Mod to HTC One M9+

Work of XDA Recognized Developer tbalden, CleanSlate custom kernel for the HTC … more

Sunday Debate: Which Factors Caused HTC’s Woes?

Join us in a fun Sunday Debate on HTC’s situation. Come with your … more

HTC’s New Ad Campaign And What It Really Means

HTC has just released three new blind test adverts comparing app loading … more

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

44 posts
Thanks Meter: 182
 
Post Reply Subscribe to Thread Email Thread
6th January 2015, 09:54 PM |#31  
bluflight's Avatar
Senior Member
Thanks Meter: 752
 
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,868
 
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