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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T07:09:51+00:00 2026-06-03T07:09:51+00:00

I have an Android activity where I’m executing NDK compiled code (command line program)

  • 0

I have an Android activity where I’m executing NDK compiled code (command line program) with:

Runtime.getRuntime().exec(myCommand);

and load the needed shared libraries with:

static {
    System.loadLibrary(myLib);
}

but when running my project and printing the output from error stream I get the following error:

link_image[1963]:  7520 could not load needed library 'libmyLib.so' for './myCommand'
(load_library[1105]: Library 'libmyLib.so' not found)CANNOT LINK EXECUTABLE

I assure libmyLib.so does exist in my project under libs/armeabi/ directory and it’s copied to my Android device under /data/data/myProject.path.package/lib/ directory. Owner and group of both executable and library are system:system and permissions are ok as well.

When executing the command from adb shell in the beginning I get the same error but then I can set LD_LIBRARY_PATH and it runs ok:

./adb shell
export LD_LIBRARY_PATH=/data/data/myProject.path.package/lib:$LD_LIBRARY_PATH
/data/data/myProject.path.package/myCommand

So the question is, how to do that from java Android project?

Note: I’m using Linux, Eclipse + Sequoyah, NDK-r5b, Android 2.3.6 (API 10) on GT-P1010.

  • 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-03T07:09:52+00:00Added an answer on June 3, 2026 at 7:09 am

    Solved: you can use exec(String prog, String[] envp). In my case this was:

    String[] envp = {"LD_LIBRARY_PATH=/data/data/cse.ecg.dcmtk/lib:$LD_LIBRARY_PATH"};
    Runtime.getRuntime().exec(myCommand, envp);
    

    The issue now is that with exec() the process executed can’t resolve hostnames (it does from adb shell; Internet permission is set). Any hint about that?

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

Sidebar

Related Questions

I have this code: package com.powergroupbd.timer; import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.os.CountDownTimer;
I have an Android activity with a list. Each item can be clicked and
I have an android activity that downloads content from the web. The activity have
I have a ListView on my Android Activity. When I scroll it, the background
So I have a very simple android activity that starts a timer when you
I have an Android app which includes an activity called Help This uses a
I need to perform action, when my activity is fully loaded? Does Android have
I have an Activity in Android, with two elements: EditText ListView When my Activity
I have Activity A with android:launchMode=singleTop in the manifest. If I go to Activity
In my Android Application I have a Google MapView Activity and I am facing

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.