如何在kivy项目中隐藏python代码文件和其他相关文件

时间:2023-03-21
本文介绍了如何在kivy项目中隐藏python代码文件和其他相关文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

问题描述

我最近在 Google Play 上发布了一个用 Python/Kivy 编写的 Android 应用程序.通常,build.py"脚本会将整个项目文件打包到一个文件夹中,即应用程序包文件夹.但是如果我在安装 apk 后在手机上查看这个包的内容,我可以找到 "android.txt" 文件,即 ".kv/.kv~" 文件和 ".py~"* 和 *"pyo" 文件.

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.

我的问题是:公开源代码文件是否安全,或者我的项目编译中是否缺少某些东西?更让我恼火的是暴露整个项目源代码的临时文件 *.kv~.py~.*

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

但我应该提到我对 Kivy 项目和 Kivy 团队的感激和尊重.他们的努力使我能够使用 Python 构建和发布一个不错的 Android 应用程序,这让我感到非常自豪.非常感谢 Kivy 团队.

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.

推荐答案

我最近在 Google Play 上发布了一个用 Python/Kivy 编写的 Android 应用程序

I have recently published an Android application on Google Play written in Python/Kivy

恭喜.请问是什么app?

Congratulations. May I ask what app it is?

我的问题是:公开源代码文件是否安全,或者我的项目编译中是否缺少某些内容?更让我恼火的是临时文件 .kv~ 和 .py~ 暴露了整个项目的源代码.

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.

正如 TwilightSun 所解释的,其中一些文件是编辑器备份,您可以通过修改 buildozer.spec 文件或直接使用的等效 python-for-android 命令从 apk 中删除或排除这些文件.

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.

但是,更一般地说,如果您认真对待混淆代码,则需要采取进一步措施.我不是专家,但这可能包括将您的 kv 代码移动到 python 文件(使用 Builder.load_string)和使用 cython 编译整个项目.生成的二进制文件将比默认包含的 python .pyo 字节码更难反编译.

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.

这篇关于如何在kivy项目中隐藏python代码文件和其他相关文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

上一篇:如何捕获 kivy-client 崩溃日志并将其发送到我的服务器? 下一篇:从现有实例调用方法

相关文章