问题
I have recently published an Android application on Google Play written in Python/Kivy. Normally the "build.py" script would wrap the whole project files into one single folder that is the application package folder. But if i check the content of this package on my phone after the installation of the apk i can find the "android.txt" file, the ".kv/.kv~" file and the ".py~"*and *"pyo" files.
My question is: is this safe to expose the source code files or is there something that i am missing in the compilation of my project ? What is annoying me more are the temporary files *.kv~ and .py~ that are exposing the whole project source code.*
But i should mention the gratitude and the respect i have for the Kivy project and the Kivy team. Their efforts allowed me to build and publish a nice Android application with Python that i am really proud of. Thank you so much Kivy team.
回答1:
I have recently published an Android application on Google Play written in Python/Kivy
Congratulations. May I ask what app it is?
My question is: is this safe to expose the source code files or is there something that i am missing in the compilation of my project ? What is annoying me more are the temporary files .kv~ and .py~ that are exposing the whole project source code.
As TwilightSun has explained, some of these files are editor backups, which you can remove or exclude from the apk by modifying your buildozer.spec file or the equivalent python-for-android commands if using that directly.
However, more generally, if you are serious about obfuscating your code you will want to take further steps. I'm no expert, but probably this would include things like moving your kv code to a python file (with Builder.load_string
) and compiling your whole project with cython. The resulting binaries will be harder to decompile than the python .pyo bytecode that is included by default.
回答2:
Those files may be editor backups which kivy doesn't recognize.
You can edit the build.py and add some patterns to BLACKLIST_PATTERNS. For your issue, you should add '*~' to the black list.
来源:https://stackoverflow.com/questions/21252729/how-to-hide-python-code-file-and-other-related-files-in-a-kivy-project