Home > Back-end >  Can i include linux executables in my android application?
Can i include linux executables in my android application?

Time:11-14

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?

CodePudding user response:

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).

  • Related