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 7769497
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T16:10:27+00:00 2026-06-01T16:10:27+00:00

I loaded a library from the /system/libs/my_lib.so directory successfully. How can I use the

  • 0

I loaded a library from the /system/libs/my_lib.so directory successfully. How can I use the C/C++ functions which are defined in this library?

public class MainFrom extends Activity {

    private static final String LOG_TAG = "MainFrom";

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);  
        setContentView(R.layout.main); 
        // How to use the functions of test_lib.so? 

        /*
            java.lang.UnsatisfiedLinkError: stringFromC


        String s1 = stringFromC(), s2 = stringFromCpp();

        Log.w(LOG_TAG, stringFromC());   
        Log.w(LOG_TAG, stringFromCpp());  */
    }

    public native String stringFromC();
    public native String stringFromCpp();

    static {
        try { 
            System.load("/system/lib/test_lib.so");
            Log.i(LOG_TAG, "MainFrom. Success!");
        } catch (UnsatisfiedLinkError e) {
            Log.e(LOG_TAG, "MainFrom. UnsatisfiedLinkError");
        }
    }

}

stringFromC and stringFromCpp exist in .c and .cpp files which were compiled to test_lib.so

  • 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-01T16:10:29+00:00Added an answer on June 1, 2026 at 4:10 pm

    I have solved my problem.

    It was necessary to write

    System.load("/system/lib/libtest_lib.so");
    

    instead of

    System.load("/system/lib/test_lib.so");
    

    So strange. If I run

    adb shell 
    ls /system/lib
    

    I will see test_lib.so file. Why is it correctlly to load library using lib prefix?

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

Sidebar

Related Questions

dyld: Library not loaded: /System/Library/Frameworks/OpenCL.framework/Versions/A/Libraries/libclparser.dylib Referenced from: /opt/local/bin/identify Reason: image not found Does anyone
I'm dynamically loading movie clips (SWFS) into attached clips (from the library). The loaded
im trying to use a file upload control from the obout control library, i
When trying to use convert(1), I get the following error: dyld: Library not loaded:
I loaded a 640 x 480 (in px) jpg image from res using Bitmap.
I loaded an UIView out of a nib-file. I wrote some methods which I
I have a sprite loaded from a PNG that has an alpha channel. The
Given a loaded Bitmap object. I want to slice up this image into 256x256
Here's the setup: A pure DotNET class library is loaded by an unmanaged desktop
how can I set up a Universal project which has support for iAd (just

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.