Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7854707
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T20:09:19+00:00 2026-06-02T20:09:19+00:00

I have to use two native libraries: one is my own and the other

  • 0

I have to use two native libraries: one is my own and the other one is 3rd-party. As long as I used them in separate projects, everything was ok. But now I’m getting the Exception Ljava/lang/UnsatisfiedLinkError.

I’m using Eclipse.

I found out that if I place the existing library in libs/armeabi, Eclipse begins compilation of the native code and it fails. If I rebuild the JNI part from the command line, compilation succeeds but the 3rd party library disappears. Really stupid.

So how do I tell Eclipse to use an existing .so library along with a library that must be built? The libraries are independent.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T20:09:22+00:00Added an answer on June 2, 2026 at 8:09 pm

    The NDK allows for linking with prebuilt user libraries, using the PREBUILT_SHARED_LIBRARY variable.

    Assuming that the library you need to link is librandom.so, create a libs folder in jni subfolder of the project folder:

    mkdir -p jni/libs
    cp librandom.so jni/libs
    

    Then, just create a jni/libs/Android.mk file:

    LOCAL_PATH := $(call my-dir)
    
    include $(CLEAR_VARS)
    LOCAL_MODULE := random
    LOCAL_SRC_FILES := librandom.so
    include $(PREBUILT_SHARED_LIBRARY)
    

    You can create a section for each prebuilt library, all placed in jni/libs.

    Next, you just need to include the above file into your jni/Android.mk to get things to work. In the NDK docs, it is recommended that this be done at the end of the Android.mk, rather than the middle:

    include $(LOCAL_PATH)/libs/Android.mk
    

    However, you’ll need to do this before the module that requires this library.

    For linking, you’ll need to add the following into the module section that links to the prebuilt library.

    LOCAL_SHARED_LIBRARIES := random
    

    Then when you do ndk-build, it will copy this library into libs/armeabi/ before building the module, and you’re good to go.

    Note: This does not solve problems with required headers. You’ll still need to add the location of the headers for the library into the variable LOCAL_C_INCLUDES in the module that requires it.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Why do I need two of them? When I have to use one or
I have two apps that use custom URL schemes to switch between each other.
I have two apps on Heroku and I would like them to use the
So I have a native 3rd party C++ code base I am working with
Scenario I have a windows forms application. I want to use two different WCF
I have two queries use [DatabaseAA] select * ,DATEDIFF(MINUTE,SomeDate,'3/28/2012 12:52:25 PM +00:00') This passes,
I have a varchar field in my database which i use for two significantly
I have two unrelated processes that use .NET assemblies as plugins. However, either process
I have two stored procedures I wish to use in my stored procedure, but
I have two tabbar items(views) that use the same data, whats the best solution

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.