kivy-garden / mapview

Mapview is a Kivy widget for displaying interactive maps.
https://kivy-garden.github.io/mapview/
MIT License
88 stars 29 forks source link

Still kivy_garden.mapview module issues with buildozer in 2022 ? #53

Closed Iji69 closed 2 years ago

Iji69 commented 2 years ago

Hello all,

I'm writing this post because I get a problem while launching my app on android (It crashes while trying to open it on android) My app uses kivy and kivymd as a GUI. It also uses kivy_garden.mapview to display a map. It works perfectly fine on my PC. I compile it via google collab virtual environment using the "checklist" described here :

https://towardsdatascience.com/3-ways-to-convert-python-app-into-apk-77f4c9cd55af

Concerning the buildozer.spec file I know that kivy_garden.mapview is no longer specified with these following lines :

Garden requirements

garden_requirements = mapview

So I let it like this :

Garden requirements

garden_requirements =

Instead, as explained on diverse GitHub threads or StackOverflow threads, I specified the kivy_garden.mapview module this way :

requirements = python3,kivy==2.0.0,kivymd==0.104.2,numpy,pillow,kivy_garden.mapview,openssl,requests

The compilation works fine and create the .apk without any problem. But when I launch the app on Android, it crashes. I read in the MapView documentation the following advises :

" Requirements : It requires the concurrent.futures and requests. If you use it on Android / iOS, don't forget to add openssl as a requirements, otherwise you'll have an issue when importing urllib3 from requests. "

That's why there is "openssl" and "requests" in my requirements above in the .spec file. I also tried adding "urllib3" and even "futures" to the requirements.

My script (main.py) starts with these libraries imports :

import kivy kivy.require('2.0.0') import kivymd from kivymd.uix.screen import MDScreen from kivymd.app import MDApp from kivy.uix.image import Image from kivymd.uix.button import MDFillRoundFlatButton from kivymd.uix.textfield import MDTextField from kivymd.uix.label import MDLabel from kivy_garden.mapview import MapView, MapSource, MapMarker import numpy as np

I tried everything from buildozer/mapview issues threads like these ones :

https://github.com/kivy/buildozer/issues/1186

https://github.com/kivy-garden/mapview/issues/43

https://github.com/kivy/buildozer/issues/1150

But it didn't helped... Can someone tell me how to make working kivy garden mapview on android in 2022 ?

NB: I created a version of my app without the "map functionnality", so everything as above except the kivy_garden.mapview module and it compiled and worked perfectly fine

HyTurtle commented 2 years ago

requests' requires need to be included: https://github.com/psf/requests/blob/main/setup.py#L43

A logcat would've stated as such.

Iji69 commented 2 years ago

Thank you for your answer !

But you mean in the spec file at the ligne "requirements" ? or else where ? (in my script .py for ex ?)

Because I already put request in my spec file as written above.

(Sorry i'm beginning at kivy and buildozer :) )

HyTurtle commented 2 years ago

At that line, but you'd need: requirements = python3,kivy==2.0.0,kivymd==0.104.2,numpy,pillow,kivy_garden.mapview,openssl,requests,charset_normalizer,chardet,idna, urllib3,certifi (certifi should be included already by default but no harm having it here just in case)

Iji69 commented 2 years ago

Oh I'll try that, in fact these other requirements where unknown to me.

I will tell you if it worked :)

zaheerkzz commented 2 years ago

At that line, but you'd need: requirements = python3,kivy==2.0.0,kivymd==0.104.2,numpy,pillow,kivy_garden.mapview,openssl,requests,charset_normalizer,chardet,idna, urllib3,certifi (certifi should be included already by default but no harm having it here just in case)

worked for me.

BogdanB98 commented 1 year ago

Hello everyone! I'm facing the same problem that I can't solve. Have you solved it? Please e-mail to me bonteanubogdan1998@gmail.com and we can discuss more. Thank you