FORUMS

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

48 posts
Thanks Meter: 214
 
Post Reply Subscribe to Thread Email Thread
6th January 2015, 10:54 PM |#31  
bluflight's Avatar
Senior Member
Thanks Meter: 802
 
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?
The Following User Says Thank You to bluflight For This Useful Post: [ View ]
 
 
7th January 2015, 12:32 AM |#32  
Recognized Developer / Recognized Contributor
Thanks Meter: 3,278
 
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 3 Users Say Thank You to _that For This Useful Post: [ View ]
26th August 2015, 07:53 AM |#33  
wladimir_tm's Avatar
Member
Thanks Meter: 45
 
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 ]
12th October 2015, 01:27 PM |#34  
Junior Member
Thanks Meter: 0
 
More
lib/libcodecvdry.so
hey im getting this error while sideloading ota
how can i solve this
2nd February 2016, 06:18 AM |#35  
Junior Member
Thanks Meter: 0
 
More
thancks for tutorial.
but where can i download missing .so files?
2nd February 2016, 10:04 AM |#36  
Recognized Developer / Recognized Contributor
Thanks Meter: 3,278
 
More
Quote:
Originally Posted by andro_007

thancks for tutorial.
but where can i download missing .so files?

From your stock ROM, usually in /system/lib or /vendor/lib or similar.
2nd February 2016, 11:29 AM |#37  
Junior Member
Thanks Meter: 0
 
More
Quote:
Originally Posted by _that

From your stock ROM, usually in /system/lib or /vendor/lib or similar.

thanx
but the stock rom is just one file named UPDATE.APP
how can i extract it?
2nd February 2016, 08:27 PM |#38  
Recognized Developer / Recognized Contributor
Thanks Meter: 3,278
 
More
Quote:
Originally Posted by andro_007

thanx
but the stock rom is just one file named UPDATE.APP
how can i extract it?

Get it from your running device, that's probably easier.
Post Reply Subscribe to Thread

Guest Quick Reply (no urls or BBcode)
Message:
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes