简体   繁体   English

在 Android 上部署 Kivy 时没有错误但应用程序在加载屏幕后崩溃

[英]No Error while Deploying Kivy On Android But app crashes after loading screen

I am trying to deploy kivy app on android it works perfectly fine in my linux machine but when I deploy the same app on android it crashes after loading screen.我正在尝试在 android 上部署 kivy 应用程序,它在我的 linux 机器上运行良好,但是当我在 android 上部署相同的应用程序时,它在加载屏幕后崩溃。 Note: There are no errors shown while deploying the app.注意:部署应用程序时没有显示错误。 It uses internet and I have also given Internet permissions.它使用互联网,我也给了互联网权限。 What may be the reason my app always crashes after loading screen in android.在android中加载屏幕后,我的应用程序总是崩溃的原因可能是什么? Here are my imports if they make any difference.如果它们有什么不同,这是我的导入。

import kivy
from kivy.app import App
from kivy.uix.widget import Widget
from kivy.uix.label import Label
from kivy.uix.button import Button
from kivy.uix.textinput import TextInput
from kivy.uix.floatlayout import FloatLayout
from kivy.properties import ObjectProperty
from kivy.clock import Clock
from functools import partial
import pandas as pd
import time
from datetime import datetime
import plyer

here is my complete code: https://github.com/sfsdsfdf/123这是我的完整代码: https : //github.com/sfsdsfdf/123

I had the same thing happening and it turned out to be a kivy version mismatch.我发生了同样的事情,结果是 kivy 版本不匹配。 I developed on Linux using Kivy 2.0.0 but buildozer was using kivy 1.9.1 To fix I had to modifiy buildozer.spec file to specify the kivy version number.我使用 Kivy 2.0.0 在 Linux 上开发,但 buildozer 使用的是 kivy 1.9.1 为了修复我不得不修改 buildozer.spec 文件来指定 kivy 版本号。 First remove cached buildozer files:首先删除缓存的构建器文件:

rm ~./.buildozer

and

rm <project>/.buildozer

change from this:从此改变:

requirements = python3,kivy

to this:对此:

requirements = python3,kivy==2.0.0,<your other requirements here>

make sure all of your file extensions are included in the builder.spec For example I had to add json and wav确保所有文件扩展名都包含在 builder.spec 例如我必须添加 json 和 wav

# (list) Source files to include (let empty to include all the files)
source.include_exts = py,png,jpg,kv,atlas,json,wav

I also noticed that the kivy version in我还注意到 kivy 版本

.buildozer/android/platform/python-for-android/pythonforandroid/recipes/kivy/__init__.py

was incorrect.不正确。 I don't know why or how this is set up so I just edited the file manually.我不知道为什么或如何设置,所以我只是手动编辑了文件。 It had v 1.11.1 but I'm using 2.0.0 so I just changed it to that.它有 v 1.11.1,但我使用的是 2.0.0,所以我只是将其更改为。

class KivyRecipe(CythonRecipe):
    version = '2.0.0'
    url = 'https://github.com/kivy/kivy/archive/{version}.zip'
    name = 'kivy'

Then run然后运行

buildozer -v android debug

and it should produce a working .apk file.它应该生成一个有效的 .apk 文件。

if you still have errors run the app from the emulater or from you phone with USB debugging enabled and use如果您仍然有错误,请从模拟器或启用 USB 调试的手机运行应用程序并使用

abd logcat tee debug.log 

And look for errors.并寻找错误。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM