Mapview on Android

428 views
Skip to first unread message

Max Bedacht

unread,
Aug 12, 2016, 12:43:02 PM8/12/16
to Kivy users support
I am trying to build a simple example based on the GIT example code. It works fine on Windows once the concurrent.futures and requests are installed.

I tried to run the main.py with the Kivy Launcher with no sucess - couldn't find the mapview import.

I then built an APK with buildozer and tried to run on my phone. It blows up trying to load concurrent.futures:

08-12 13:16:27.467 I/python  (14031):    File "/home/kivy/GIT/maptest/.buildozer/android/app/main.py", line 6, in <module>
08-12 13:16:27.467 I/python  (14031):    File "/home/kivy/GIT/maptest/.buildozer/android/platform/python-for-android/build/python-install/lib/python2.7/site-packages/kivy/garden/__init__.py", line 100, in load_module
08-12 13:16:27.468 I/python  (14031):    File "/home/kivy/GIT/maptest/.buildozer/android/platform/python-for-android/build/python-install/lib/python2.7/site-packages/kivy/garden/__init__.py", line 104, in _load_module
08-12 13:16:27.469 I/python  (14031):    File "/home/kivy/GIT/maptest/.buildozer/android/app/libs/garden/garden.mapview/__init__.py", line 3, in <module>
08-12 13:16:27.470 I/python  (14031):    File "/home/kivy/GIT/maptest/.buildozer/android/app/libs/garden/garden.mapview/mapview/__init__.py", line 30, in <module>
08-12 13:16:27.470 I/python  (14031):    File "/home/kivy/GIT/maptest/.buildozer/android/app/libs/garden/garden.mapview/mapview/source.py", line 8, in <module>
08-12 13:16:27.471 I/python  (14031):    File "/home/kivy/GIT/maptest/.buildozer/android/app/libs/garden/garden.mapview/mapview/downloader.py", line 8, in <module>
08-12 13:16:27.472 I/python  (14031):  ImportError: No module named concurrent.futures
08-12 13:16:27.497 I/python  (14031): Python for android ended.

I tried to install the concurrent.futures on the python installed in the VB image but it seems to have no effect on the resultant APK.

Any pointers to get this running?

Thanks

Rafał Kaczor

unread,
Aug 13, 2016, 4:52:26 PM8/13/16
to Kivy users support
Add futures and openssl to requirements in buildozer.spec file (if using Buildozer). Next time check the docs twice :) https://github.com/kivy-garden/garden.mapview

From MapView's Github:

"It requires the concurrent.futures and requests. If you are on python 2.7, you can use futures:

pip install futures requests

If you use it on Android / iOS, don't forget to add openssl as a requirements, otherwise you'll have an issue when importingurllib3 from requests."

All the best with Kivy! :)

Max Bedacht

unread,
Aug 16, 2016, 10:57:05 AM8/16/16
to Kivy users support
Thanks - I had read the docs (more than twice) but did not understand fully.

Now I got another question / problem:

I am getting an error when zooming the map which seems to be connected with bad images coming from openstreetmap:
_______________________________________________________________________________
[WARNING           ] [Image       ] Unable to load image <cache\26a7511794_19_193479_228088.png>
[INFO              ] [Base        ] Leaving application in progress...
 Traceback (most recent call last):
   File "C:/Users/Max/Documents/GIT/fuelchoicenogoog/main.py", line 1712, in <module>
     FuelChoiceApp().run()
   File "C:\Python27\lib\site-packages\kivy\app.py", line 828, in run
     runTouchApp()
   File "C:\Python27\lib\site-packages\kivy\base.py", line 487, in runTouchApp
     EventLoop.window.mainloop()
   File "C:\Python27\lib\site-packages\kivy\core\window\window_sdl2.py", line 619, in mainloop
     self._mainloop()
   File "C:\Python27\lib\site-packages\kivy\core\window\window_sdl2.py", line 362, in _mainloop
     EventLoop.idle()
   File "C:\Python27\lib\site-packages\kivy\base.py", line 327, in idle
     Clock.tick()
   File "C:\Python27\lib\site-packages\kivy\clock.py", line 515, in tick
     self._process_events()
   File "C:\Python27\lib\site-packages\kivy\clock.py", line 647, in _process_events
     event.tick(self._last_tick, remove)
   File "C:\Python27\lib\site-packages\kivy\clock.py", line 406, in tick
     ret = callback(self._dt)
   File "C:\Users\Max\.kivy\garden\garden.mapview\mapview\downloader.py", line 87, in _check_executor
     callback(*args)
   File "C:\Users\Max\.kivy\garden\garden.mapview\mapview\view.py", line 93, in set_source
     self.source = cache_fn
   File "kivy\graphics\instructions.pyx", line 360, in kivy.graphics.instructions.VertexInstruction.source.__set__ (kivy\graphics\instructions.c:7210)
   File "kivy\graphics\context_instructions.pyx", line 381, in kivy.graphics.context_instructions.BindTexture.source.__set__ (kivy\graphics\context_instructions.c:7367)
   File "C:\Python27\lib\site-packages\kivy\core\image\__init__.py", line 512, in __init__
     self.filename = arg
   File "C:\Python27\lib\site-packages\kivy\core\image\__init__.py", line 700, in _set_filename
     mipmap=self._mipmap, nocache=self._nocache)
   File "C:\Python27\lib\site-packages\kivy\core\image\__init__.py", line 430, in load
     im = loader(filename, **kwargs)
   File "C:\Python27\lib\site-packages\kivy\core\image\__init__.py", line 198, in __init__
     self._data = self.load(filename)
   File "C:\Python27\lib\site-packages\kivy\core\image\img_sdl2.py", line 42, in load
     raise Exception('SDL2: Unable to load image')
 Exception: SDL2: Unable to load image
_____________________________________________________________________________________________

Is there any way to catch this error and avoid the crash it causes?

Thanks again for you prior help
Reply all
Reply to author
Forward
0 new messages