Anders Brownworth

Technology and Disruption

Android ROM Development - System Level Shared Library Not Found

If system-level Android apps are failing because they can't find a "shared library":

--------
E/PackageManager( 118): Package com.example.foo requires unavailable shared library com.example.bar; failing!
--------

and you don't see that library mentioned earlier in the "Libs:" line as the system loads:

--------
I/PackageManager( 117): Libs: android.test.runner:/system/framework/android.test.runner.jar com.android.qualcomm.qcrilhook:/system/framework/qcrilhook.jar javax.obex:/system/framework/javax.obex.jar com.google.android.maps:/system/framework/com.google.android.maps.jar
--------

Make sure the jar file exists and add a reference to it by creating a file:

--------
/system/etc/permissions/example.xml
--------

with contents similar to this:

--------
<?xml version="1.0" encoding="utf-8"?>
<permissions>
<library name="com.example.bar"
file="/system/framework/example.jar"/>
</permissions>
--------

On reboot, your "Libs:" line should now include this library and your app should find it:

--------
I/PackageManager( 117): Libs: android.test.runner:/system/framework/android.test.runner.jar com.android.qualcomm.qcrilhook:/system/framework/qcrilhook.jar javax.obex:/system/framework/javax.obex.jar com.google.android.maps:/system/framework/com.google.android.maps.jar com.example.bar:/system/framework/example.jar
--------

Android reads through /system/etc/permissions/*.xml to build up the default library list.

Comments (2)

tedex from

I do all of the steps above, but after reboot the libraries and the xml are gone! I have a rooted HTC one M8. any ideas?

Anders from Cambridge, MA

You need to be making these changes in the unpacked initramfs before you repack it into a gzipped cpio archive and load it onto your phone. The filesystem on your phone when it is running looks like a normal filesystem but it is actually just in RAM and all changes will be lost on the next boot. You need to alter the version that first comes up on boot - that's what the initramfs is used for.

Leave a Comment

Name:
Location: (city / state / country)
Email: (not published / no spam)
Comment:

No HTML is allowed. Cookies must be enabled to post. Your comment will appear on this page after a moderator OKs it. Offensive content will not be published.

Click the firetruck to submit your comment.

To create links in comments:
[link:http://anders.com/] becomes http://anders.com/
[link:http://anders.com/|Anders.com] becomes Anders.com
Notice there is no rel="nofollow" in these hrefs. Links in comments will carry page rank from this site so only link to things worthy of people's attention.