Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Can i include linux executables in my android application?

I have created a python app that calls subprocess to 7z.exe On windows and 7z on linux and it works fine.

subprocess.run('7z x ...')

What about android will the linux executable version of 7z
work with my python script on android?

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

It depends on the CPU architecture of the phone.
The most common CPU processor types of android smartphones are arm, arm64, x86.

When you build linux binaries on your linux system (debian, ubuntu), you must consider, that there is neither a full standard C-libary e.g. glibc, nor a faster smaller embedded libc like dietlibc on android.

So you must compile a static binary with all libs linked in and maybe cross compile the binary with gcc for several most common android cpus.

Java vm abstraction is standard for android applications.
When you execute a linux binary from your android app like SDMaid does it, please take care, that the binary will be located inside the app data partition (with all mount restrictions of that partition) and that it will be run under UserId and GroupId of that Android App. (UserId and GroupId will normally be different on any android phone, because they depends on the installation order of the specific app and how many apps where preinstalled from android phone vendor).

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading