如何为 android 调试 Kivy/Kivymd 应用程序?

How to debug a Kivy/Kivymd app for android?(如何为 android 调试 Kivy/Kivymd 应用程序?)
本文介绍了如何为 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 应用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐

How to target newer versions in .gitlab-ci.yml using auto devops (java 11 instead of 8 and Android 31 instead of 29)(如何在.gitlab-ci.yml中使用自动开发工具(Java 11而不是8,Android 31而不是29)瞄准较新的版本)
Android + coreLibraryDesugaring: which Java 11 APIs can I expect to work?(Android+core LibraryDesugering:我可以期待哪些Java 11API能够工作?)
How to render something in an if statement React Native(如何在If语句中呈现某些内容Reaction Native)
How can I sync two flatList scroll position in react native(如何在本机Reaction中同步两个平面列表滚动位置)
Using Firebase Firestore in offline only mode(在仅脱机模式下使用Firebase FiRestore)
Crash on Google Play Pre-Launch Report: java.lang.NoSuchMethodError(Google Play发布前崩溃报告:java.lang.NoSuchMethodError)