問題描述
所以我花了一些時間開發一個食譜應用程序:Github 我可以與我的 Raspberry Pi 一起使用,效果很好,我不介意在那里為原始代碼使用啟動器.但是我希望能夠使用 buildozer 方法將 Kivy 應用程序打包為 apk:
So I have spent some time developing a recipe app: Github I can use with my Raspberry Pi, which works great and I don't mind using a launcher for the raw code there. However I wanted to be able to package the Kivy application as an apk using the buildozer method:
buildozer android debug deploy run
編譯成功并且apk安裝正常,但是應用程序在一秒鐘后崩潰,之后我嘗試使用似乎永遠無法識別我的程序的Kivy Launcher,所以我繼續嘗試通過Pydroid 3運行原始代碼,這在過去對 Kivy 和 KivyMD 都有效,但是在嘗試此導入時它會崩潰,這不是我的代碼的一部分:
Which compiles successfully and the apk installs fine, however the application crashes after a second, after that I tried using the Kivy Launcher which never seems to recognise my program, so i moved on to trying to run the raw code through Pydroid 3, which has worked in the past for both Kivy and KivyMD however it crashes trying this import which isnt a part of my code:
from android.config import JAVA_NAMESPACE, JNI_NAMESPACE
我的 buildozer.spec 文件是:
my buildozer.spec file is:
https://github.com/treencd/RecipeBook/blob/master/buildozer.spec
我最終嘗試使用:
adb logcat
但是輸出似乎沒有幫助,或者我不知道我在尋找什么.
However the output doesn't seem that helpful or I dont know what i'm looking for.
我真的可以使用一些指導來調試這樣的應用程序.
I could really use some direction on how to go about debugging an application like this.
推薦答案
需要3個步驟(手機開啟調試模式省略).您可以將每個步驟保存為 bash 文件,然后輕松運行腳本.假設文件夾結構如下
You need 3 steps (omitted enabling debug mode on cellphone). You can save each step as bash files then run the scripts easily. Assuming the folder structure below
project/
1.bash
2.bash
3.bash
bin/
random_name.apk
main.py
main.kv
1) 構建apk (1.bash)
1) Build apk (1.bash)
#!/bin/sh
buildozer -v android debug
2)從終端(2.bash)安裝在手機上
2) Install on cellphone from terminal (2.bash)
#!/bin/sh
adb install -r bin/*.apk
3) 運行 apk 并查看發生了什么 (3.bash)
3) Running the apk and see what's happening (3.bash)
#!/bin/sh
echo 'Please connect on transfer files mode the cellphone'
adb logcat -s "python"
然后當一切正常時,只需創建一個新文件(0.bash)
Then when all is working just create a new file (0.bash)
#!/bin/sh
bash 1.bash
bash 2.bash
bash 3.bash
這篇關于如何為 android 調試 Kivy/Kivymd 應用程序?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!