How to debug a Kivy/Kivymd app for android?(如何为 android 调试 Kivy/Kivymd 应用程序?)
问题描述
所以我花了一些时间开发一个食谱应用程序: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 应用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:如何为 android 调试 Kivy/Kivymd 应用程序?
基础教程推荐
- 当从同一个组件调用时,两个 IBAction 触发的顺序是什么? 2022-01-01
- 在 gmail 中为 ios 应用程序检索朋友的朋友 2022-01-01
- UIWebView 委托方法 shouldStartLoadWithRequest:在 WKWebView 中等效? 2022-01-01
- 如何让对象对 Cocos2D 中的触摸做出反应? 2022-01-01
- Android:对话框关闭而不调用关闭 2022-01-01
- android 应用程序已发布,但在 google play 中找不到 2022-01-01
- Kivy Buildozer 无法构建 apk,命令失败:./distribute.sh -m “kivy"d 2022-01-01
- 如何在没有IB的情况下将2个按钮添加到右侧的UINavigationbar? 2022-01-01
- 如何在 iPhone 上显示来自 API 的 HTML 文本? 2022-01-01
- 如何在 UIImageView 中异步加载图像? 2022-01-01