i’ve just recently began to develop using kivy for testing purposes and build the first .apk , so one question comes to mind.
The main.py contains source code that maybe i don’t want to be “readable” if i want to distribute my apk… so is there a way to encode or hide my primary code when i create a .apk for google play store or as a normal linux app?
Thanks guys!
The .py is not shipped into the apk an the end, only the .pyo (Python Bytecode, optimized version, no docstring).
Still, bytecode can be reversed.
You could use Cython to generate a C of your app (.pyx -> .c -> .so). All the main.py could do is:
And you would have a myencodedlib.pyx that contain all the thing you want to compile into a binary C. (A side note, python-for-android need a recipe to compile python extensions. Look at the recipes/ directory to see how it’s done for others.)
One last note, a .so is still decompilable for more advanced hackers. But then you would have a bunch of cpython call, with generated variables names. It would take severals hours to understand it. 🙂