問題描述
我最近在 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代碼文件和其他相關文件的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!