問題描述
所以我花了一些時(shí)間開發(fā)一個(gè)食譜應(yīng)用程序:Github 我可以與我的 Raspberry Pi 一起使用,效果很好,我不介意在那里為原始代碼使用啟動器.但是我希望能夠使用 buildozer 方法將 Kivy 應(yīng)用程序打包為 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安裝正常,但是應(yīng)用程序在一秒鐘后崩潰,之后我嘗試使用似乎永遠(yuǎn)無法識別我的程序的Kivy Launcher,所以我繼續(xù)嘗試通過Pydroid 3運(yùn)行原始代碼,這在過去對 Kivy 和 KivyMD 都有效,但是在嘗試此導(dǎo)入時(shí)它會崩潰,這不是我的代碼的一部分:
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.
我真的可以使用一些指導(dǎo)來調(diào)試這樣的應(yīng)用程序.
I could really use some direction on how to go about debugging an application like this.
推薦答案
需要3個(gè)步驟(手機(jī)開啟調(diào)試模式省略).您可以將每個(gè)步驟保存為 bash 文件,然后輕松運(yùn)行腳本.假設(shè)文件夾結(jié)構(gòu)如下
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) 構(gòu)建apk (1.bash)
1) Build apk (1.bash)
#!/bin/sh
buildozer -v android debug
2)從終端(2.bash)安裝在手機(jī)上
2) Install on cellphone from terminal (2.bash)
#!/bin/sh
adb install -r bin/*.apk
3) 運(yùn)行 apk 并查看發(fā)生了什么 (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"
然后當(dāng)一切正常時(shí),只需創(chuàng)建一個(gè)新文件(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
這篇關(guān)于如何為 android 調(diào)試 Kivy/Kivymd 應(yīng)用程序?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!