Verizon Fios Tech Support

  • Subscribe to our RSS feed.
  • Twitter
  • StumbleUpon
  • Reddit
  • Facebook
  • Digg

Thursday, 24 January 2013

Android: Trying to load native library results in a process terminated by signal (11)

Posted on 07:25 by Unknown

Symptoms

You are trying to load your native C/C++ library in an Android application and when at runtime your app calls the System.loadLibrary() function - for example:

static {
        System.loadLibrary("mynativelib");
}

the application dies without core dumping, and the only message you see in LogCat is something like the following:

01-23 19:58:08.699: D/dalvikvm(4146): Trying to load lib /data/data/com.example.myapp/lib/libmynativelib.so 0x42341a50
01-23 19:58:08.709: I/ActivityManager(340): Process com.example.myapp (pid 4146) has died.
01-23 19:58:08.709: W/ActivityManager(340): Force removing ActivityRecord{211d37d0 com.example.myapp/.MyActivity}: app died, no saved state
01-23 19:58:08.719: D/Zygote(188): Process 4146 terminated by signal (11)

Causes

You native library is probably trying to dynamically load another library it depends upon.

Solution

Use the GCC readelf for your ABI to dump the dynamic section of your native library and find out which libraries it depends upon. For example if you are compiling for the x86 ABI:


$ android-ndk-r8d/toolchains/x86-4.7/prebuilt/linux-x86/bin/i686-linux-android-readelf -d libmynativelib.so | grep NEEDED
 0x00000001 (NEEDED)                     Shared library: [libgnustl_shared.so]
 0x00000001 (NEEDED)                     Shared library: [libiconv.so]
 0x00000001 (NEEDED)                     Shared library: [libdl.so]
 0x00000001 (NEEDED)                     Shared library: [libstdc++.so]
 0x00000001 (NEEDED)                     Shared library: [libm.so]
 0x00000001 (NEEDED)                     Shared library: [libc.so]


In this example you only need to load libgnustl_shared.so and libiconv.so before your libmynativelib.so to resolve the dependencies and make the System.loadLibrary() function call happy (the other standard libraries are already preloaded for you by Android). In your static section you will then include the following lines:


static {
        System.loadLibrary("gnustl_shared");
        System.loadLibrary("iconv");
        System.loadLibrary("mynativelib");
}

This should solve the problem.

Email ThisBlogThis!Share to XShare to FacebookShare to Pinterest
Posted in Android, x86 | No comments
Newer Post Older Post Home

0 comments:

Post a Comment

Subscribe to: Post Comments (Atom)

Popular Posts

  • Free Blogger Opp – Timjan Design Malachite 5/1
    Here comes another Visionary Bri blogger opportunity. Sign up now for the Timjan Bloomers Giveaway. Our sponsor, Timjan Design , has offered...
  • Problems with new version of rpmbuild
    The Problem With the new version of rpmbuild installed on CentOS 6.x, if you try to use an old RPM spec file, you will get an error like the...
  • Installing the Android SDK
    These instructions refer to a Ubuntu 12.04.1 LTS system running on an Intel processor. Head to the developer.android.com web site and downl...
  • Meeting The Tate's
       Hello, we are Cody and Aimee Tate. We live in Florida and have been married for 3 years. Recently we have decided to start doing product ...
  • How to Cross-Compile libiconv for Android
    If your legacy C/C++ code includes <iconv.h> to convert the encoding of characters from one coded character set to another, and you ne...
  • Python For Android (Py4A)
    A better solution for cross-compiling Python for Android is to use the Py4A project which is made to be used together with SL4A (Scripting L...
  • Free Blogger Op Getting Ready for Summer Giveaway
    Hosted by:   NYSavingSpecials   and  Your Fashion Resource Come and join us on this great giveaway "Getting ready for Summer" We w...
  • PAINT released to the public for Research Purposes Only
    Digital Operatives is proud to release to the public for Research Purposes Only, a beta version of PAINT, Process Attribution In Network Tra...
  • How to compile busybox with Android NDK for both ARM and x86 architectures
    I was looking for a way to run busybox on a Motorola RAZRi with an x86 Intel Atom processor but I couldn't find any Android app from th...
  • DermOrganics Review
    "DermOrganic ®  products are made using ingredients that are synergistic to your hair and skin to replenish from the outside what your ...

Categories

  • amazon
  • amazon.com
  • Android
  • Apple
  • Arduino
  • ARM
  • baby
  • baby reviews
  • back to school
  • beef jerky
  • bicycle. wagon
  • bike
  • Blanket Buddies
  • blogging
  • Blogging with The Tate's
  • books
  • busybox
  • camera
  • camera giveaway
  • candle giveaway
  • candles
  • CaseApp
  • CentOS
  • coffee
  • david haskell
  • dermorganic
  • DHCP
  • digital camera
  • events
  • Florida
  • Fortran
  • free blogger giveaway
  • free blogger sign-ups
  • full of flavor
  • giveaways
  • GNU
  • GPON
  • hair care
  • happy husband
  • Hot tea
  • Husband and Wife perspective
  • iMac
  • ipad
  • iphone
  • iphone case
  • iphone case review
  • Javascript
  • Keurig Coffee Review
  • Keurig Review
  • Kindle
  • ksh
  • LifeProof iPhone Case Review
  • Linux
  • MacOSX
  • Malachite Bloomers
  • man and women perspective
  • meat
  • Mips
  • Network
  • Pretzel Crisps
  • Pretzels
  • product reviews
  • products
  • Python
  • Router
  • scentsy
  • scentsy candles
  • school
  • scooter
  • security system
  • skin care
  • snacks
  • sony
  • sony cyber-shot
  • Stuff Animal
  • suface pro
  • Summer
  • summer fun
  • surface pro giveaway
  • techno thriller
  • Timjan Design
  • too much information
  • UNIX
  • vegan
  • vegan products
  • verizon
  • verizon fios
  • VitaminsBaby
  • waterproof case
  • Windows
  • x86
  • yummy

Blog Archive

  • ▼  2013 (41)
    • ►  November (2)
    • ►  October (2)
    • ►  September (3)
    • ►  August (3)
    • ►  July (2)
    • ►  June (2)
    • ►  May (6)
    • ►  April (8)
    • ►  March (2)
    • ►  February (5)
    • ▼  January (6)
      • How to build Python-4-Android for the ARM Neon
      • How to build Python-4-Android for the x86
      • Android: Trying to load native library results in ...
      • How to port Mozilla SpiderMonkey 1.7 to Android
      • How to inspect expanded C macros with gcc/gcc+
      • Upgrading mid-2007 24in iMac with an SSD and a 2.5...
  • ►  2012 (17)
    • ►  December (3)
    • ►  November (4)
    • ►  October (8)
    • ►  July (1)
    • ►  June (1)
Powered by Blogger.

About Me

Unknown
View my complete profile