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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T00:37:04+00:00 2026-06-08T00:37:04+00:00

We are trying to pre-install a NDK Application into the /system/app directory. If I

  • 0

We are trying to pre-install a NDK Application into the /system/app directory. If I open the apk file in a ZIP file manager, the .so file is inside the lib directory. However, when we preinstall the apk file, the apk’s .so file is not copied to system/lib directory, causing for the application to fail when we launched it in the device.

Can anyone please tell me what should be set in the Android.mk for the APK file so that the .so file will be extracted from the APK file and copied to system/lib directory? We need to include the application in the system image.

Any feedback will be greatly appreciated.

Thanks,
artsylar

  • 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-08T00:37:05+00:00Added an answer on June 8, 2026 at 12:37 am

    I had the same need and after 2 days of heavy research, I came up with a solution to this problem. It is not simple and requires you to be able to modify the Android System code as well.

    Basically PackageManagerService prevents system applications to unpack their native binaries (.so files), unless they have been updated. So the only way to fix this is by modifying PMS.java (aptly named since trying to solve this problem put me in a terrible mood).

    On the system’s first boot, I check every system package for native binaries by writing a isPackageNative(PackageParser.Package pkg) function:

        private boolean isPackageNative(PackageParser.Package pkg) throws IOException {
        final ZipFile zipFile = new ZipFile(pkg.mPath);
        final Enumeration<? extends ZipEntry> privateZipEntries = zipFile.entries();
        while (privateZipEntries.hasMoreElements()) {
            final ZipEntry zipEntry = privateZipEntries.nextElement();
            final String zipEntryName = zipEntry.getName();
            if(true) Log.e(TAG, "    Zipfile entry:"+zipEntryName);
            if (zipEntryName.endsWith(".so")) {
                zipFile.close();
                return true;
            }
        }
        zipFile.close();
        return false;
      }
    

    This function checks every package for a native library and if it has one, I unpack it. PMS does this check in scanPackageLI(….). Search for the following code in the method:

       if (isSystemApp(pkg) && !isUpdatedSystemApp(pkg))
    

    and add the isPackageNative(pkg) check. There are other small modifications required but you’ll probably figure it out once you have this direction. Hope it helps!

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

Sidebar

Related Questions

I'm trying to get pre/post annotations working with a web application, but for some
I am trying to copy my pre-populated database to a writable directory (I am
I'm trying to pre-sort an array of items are added into an array using
I am trying to install SQL Server 2008 and during the pre requisite check
I'm trying to install the latest pre-release version of HoboFields , which supports Rails
I installed Bundler on a pre-Rails 3 application and am trying to use it
I use homebrew,write this order to terminal.app to install postgresql. `brew install postgresql` <pre>==>
I am trying to get the (pre-processed) content of an external PHP file: file_get_contents('http://www.example.org/myfile.php');
I am trying to install Entity Framework using the NUget package manager using the
I'm trying to pre-populate create defect popup and I'm not clear on what key/values

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.