mapview error and crash on android .

88 views
Skip to first unread message

purushottam yadav

unread,
Nov 21, 2022, 8:48:17 AM11/21/22
to Kivy users support
I got below error while using mapview   on android .  i never faced this error before  . how to deal with error .


11-21 19:06:34.446 13544 13576 I python  : [WARNING] [Image       ] Unable to load image </data/data/org.ttest.myappp/files/app/cache/26a7511794_16_47076_36005.png>
11-21 19:06:34.452 13544 13576 I python  : [INFO   ] [Base        ] Leaving application in progress...
11-21 19:06:34.457 13544 13576 I python  :  Traceback (most recent call last):
11-21 19:06:34.459 13544 13576 I python  :    File "/home/purushottamdev/directory_env/f/ff/.buildozer/android/app/main.py", line 2884, in <module>
11-21 19:06:34.474 13544 13576 I python  :    File "/home/purushottamdev/directory_env/f/ff/.buildozer/android/platform/build-arm64-v8a/build/python-installs/myappp/arm64-v8a/kivy/app.py", line 955, in run
11-21 19:06:34.474 13544 13576 I python  :    File "/home/purushottamdev/directory_env/f/ff/.buildozer/android/platform/build-arm64-v8a/build/python-installs/myappp/arm64-v8a/kivy/base.py", line 574, in runTouchApp
11-21 19:06:34.475 13544 13576 I python  :    File "/home/purushottamdev/directory_env/f/ff/.buildozer/android/platform/build-arm64-v8a/build/python-installs/myappp/arm64-v8a/kivy/base.py", line 339, in mainloop
11-21 19:06:34.475 13544 13576 I python  :    File "/home/purushottamdev/directory_env/f/ff/.buildozer/android/platform/build-arm64-v8a/build/python-installs/myappp/arm64-v8a/kivy/base.py", line 379, in idle
11-21 19:06:34.475 13544 13576 I python  :    File "/home/purushottamdev/directory_env/f/ff/.buildozer/android/platform/build-arm64-v8a/build/python-installs/myappp/arm64-v8a/kivy/clock.py", line 733, in tick
11-21 19:06:34.476 13544 13576 I python  :    File "/home/purushottamdev/directory_env/f/ff/.buildozer/android/platform/build-arm64-v8a/build/python-installs/myappp/arm64-v8a/kivy/clock.py", line 776, in post_idle
11-21 19:06:34.476 13544 13576 I python  :    File "kivy/_clock.pyx", line 620, in kivy._clock.CyClockBase._process_events
11-21 19:06:34.476 13544 13576 I python  :    File "kivy/_clock.pyx", line 653, in kivy._clock.CyClockBase._process_events
11-21 19:06:34.477 13544 13576 I python  :    File "kivy/_clock.pyx", line 649, in kivy._clock.CyClockBase._process_events
11-21 19:06:34.477 13544 13576 I python  :    File "kivy/_clock.pyx", line 218, in kivy._clock.ClockEvent.tick
11-21 19:06:34.477 13544 13576 I python  :    File "/home/purushottamdev/directory_env/f/ff/.buildozer/android/platform/build-arm64-v8a/build/python-installs/myappp/arm64-v8a/kivy_garden/mapview/downloader.py", line 115, in _check_executor
11-21 19:06:34.478 13544 13576 I python  :    File "/home/purushottamdev/directory_env/f/ff/.buildozer/android/platform/build-arm64-v8a/build/python-installs/myappp/arm64-v8a/kivy_garden/mapview/view.py", line 122, in set_source
11-21 19:06:34.478 13544 13576 I python  :    File "kivy/graphics/instructions.pyx", line 380, in kivy.graphics.instructions.VertexInstruction.source.__set__
11-21 19:06:34.479 13544 13576 I python  :    File "kivy/graphics/context_instructions.pyx", line 431, in kivy.graphics.context_instructions.BindTexture.source.__set__
11-21 19:06:34.479 13544 13576 I python  :    File "/home/purushottamdev/directory_env/f/ff/.buildozer/android/platform/build-arm64-v8a/build/python-installs/myappp/arm64-v8a/kivy/core/image/__init__.py", line 561, in __init__
11-21 19:06:34.479 13544 13576 I python  :    File "/home/purushottamdev/directory_env/f/ff/.buildozer/android/platform/build-arm64-v8a/build/python-installs/myappp/arm64-v8a/kivy/core/image/__init__.py", line 754, in _set_filename
11-21 19:06:34.480 13544 13576 I python  :    File "/home/purushottamdev/directory_env/f/ff/.buildozer/android/platform/build-arm64-v8a/build/python-installs/myappp/arm64-v8a/kivy/core/image/__init__.py", line 460, in load
11-21 19:06:34.480 13544 13576 I python  :    File "/home/purushottamdev/directory_env/f/ff/.buildozer/android/platform/build-arm64-v8a/build/python-installs/myappp/arm64-v8a/kivy/core/image/__init__.py", line 223, in __init__
11-21 19:06:34.480 13544 13576 I python  :    File "/home/purushottamdev/directory_env/f/ff/.buildozer/android/platform/build-arm64-v8a/build/python-installs/myappp/arm64-v8a/kivy/core/image/img_sdl2.py", line 47, in load
11-21 19:06:34.481 13544 13576 I python  :  Exception: SDL2: Unable to load image
11-21 19:06:34.481 13544 13576 I python  : Python for android ended.

Robert

unread,
Nov 21, 2022, 12:03:25 PM11/21/22
to Kivy users support
No idea. A guess: you might want to look for the cause of this
11-21 19:06:34.446 13544 13576 I python  : [WARNING] [Image       ] Unable to load image </data/data/org.ttest.myappp/files/app/cache/26a7511794_16_47076_36005.png>

kaukone...@gmail.com

unread,
Nov 28, 2022, 2:09:12 AM11/28/22
to Kivy users support
I forward here the bug report that was closed as github issues: (because it was said to be a support request).
Markus

Dear Developers,

**Software Versions**
* Python: 3.10
* OS: ubuntu 22.04
* Kivy: 2.1.0
* Kivy installation method: pip

**Describe the bug**
App runs fine on ubuntu 22.04  with` python main.py`
but when deploying to my android mobile phone with` buildozer android debug deploy run`
1) app starts with kivy logo
2) app crashes and goes background after couple of seconds

`adb logcat` gives
```
11-27 20:48:51.022 14315 14337 I python  :    File "kivy/graphics/instructions.pyx", line 1, in init kivy.graphics.instructions
11-27 20:48:51.023 14315 14337 I python  :    File "kivy/_event.pyx", line 1, in init kivy._event
11-27 20:48:51.024 14315 14337 I python  :    File "kivy/properties.pyx", line 279, in init kivy.properties
11-27 20:48:51.026 14315 14337 I python  :  ImportError: cannot import name Clock
11-27 20:48:51.026 14315 14337 I python  : Python for android ended.

```

Code (main.py)
```
from kivy.base import runTouchApp

from kivy_garden.mapview import MapMarker, MapView, MapSource
from kivymd.app import MDApp

map = MapView(zoom=10, lon=25, lat=60.5)
source = MapSource(url="https://tiles.kartat.kapsi.fi/peruskartta/{z}/{x}/{y}.png",
                   cache_key="kapsi", tile_size=512,
                   image_ext="png", attribution="@ MML")
map.map_source = source

runTouchApp(map)
```

buildozer.spec, non-commented lines (tried various requirements, with no effect, tried also python-for-android, but that was even more horrible a mess)

```
[app]

# (str) Title of your application
title = My Teat Mok

# (str) Package name
package.name = ymppays# (str) Path to build artifact storage, absolute or relative to spec file
# build_dir = ./.buildozer

# (str) Path to build output (i.e. .apk, .aab, .ipa) storage
# bin_dir = ./bin

#    -----------------------------------------------------------------------------
#    List as sections
#
#    You can define all the "list" as [section:key].
#    Each line will be considered as a option to the list.
#    Let's take [app] / source.exclude_patterns.
#    Instead of doing:
#
#[app]
#source.exclude_patterns = license,data/audio/*.wav,data/images/original/*
#
#    This can be translated into:
#
#[app:source.exclude_patterns]
#license
#data/audio/*.wav
#data/images/original/*
#


#    -----------------------------------------------------------------------------
#    Profiles
#
#    You can extend section / key with a profile
#    For example, you want to deploy a demo version of your application without
#    HD content. You could first change the title to add "(demo)" in the name
#    and extend the excluded directories to remove the HD content.
#
#[app@demo]
#title = My Application (demo)
#
#[app:source.exclude_patterns@demo]
#images/hd/*
#
#    Then, invoke the command line with the "demo" profile:
#
#buildozer --profile demo android debug

# (str) Package domain (needed for android/ios packaging)
package.domain = org.test

# (str) Source code where the main.py live
source.dir = .

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

# (str) Application versioning (method 1)
version = 0.1

# (list) Application requirements
# comma separated e.g. requirements = sqlite3,kivy
requirements = python3,kivy,kivymd,kivy.clock,docutils,Kivy-Garden,requests,certifi,charset-normalizer,idna,urllib3,pygments,pillow,kivy-garden.mapview,mapview,appdirs,certifi,charset-normalizer,colorama,Cython,distlib,docutils,filelock,idna,Pillow,pyproj,requests,urllib3,sh,toml,zipp

# change the major version of python used by the app
osx.python_version = 3

# Kivy version to use
osx.kivy_version = 2.1.0


# (bool) Indicate if the application should be fullscreen or not
fullscreen = 0


# (list) Permissions
android.permissions = INTERNET, READ_EXTERNAL_STORAGE

# (int) Target Android API, should be as high as possible.
android.api = 33

# (int) Minimum API your APK / AAB will support.
android.minapi = 21


[buildozer]

# (int) Log level (0 = error only, 1 = info, 2 = debug (with command output))
log_level = 2

# (int) Display warning if buildozer is run as root (0 = False, 1 = True)
warn_on_root = 1


```
Terveisin, Markus



Robert

unread,
Nov 28, 2022, 4:19:44 PM11/28/22
to Kivy users support
I expect this was tagged as a support issue because the code does not comply with the Kivy lifecycle
Therefore is not portable
The structure should be like this
Reply all
Reply to author
Forward
0 new messages