简体   繁体   中英

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. 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. 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

I had the same thing happening and it turned out to be a kivy version mismatch. 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. 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

# (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

.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.

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.

if you still have errors run the app from the emulater or from you phone with USB debugging enabled and use

abd logcat tee debug.log 

And look for errors.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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