jbrewe37
jbrewe37

Reputation: 11

Issue with aiohttp in Buildozer

I've ran into an issue trying to convert my Kivy app to an apk using Buildozer. The app performs as intended when ran through Python, and I have no issues getting Buildozer to produce an apk. I've gone down a rabbit hole of trial and error adding all of the needed modules to the .spec file as it failed to run. Now, I am getting a new error specifically from aiohttp that has me stumped.

04-09 02:36:39.248 22155 23029 I python  :  Traceback (most recent call last):
04-09 02:36:39.248 22155 23029 I python  :    File "/content/.buildozer/android/app/main.py", line 7, in <module>
04-09 02:36:39.249 22155 23029 I python  :    File "/content/.buildozer/android/platform/build-arm64-v8a_armeabi-v7a/build/python-installs/myapp/arm64-v8a/scrython/__init__.py", line 2, in <module>
04-09 02:36:39.249 22155 23029 I python  :    File "/content/.buildozer/android/platform/build-arm64-v8a_armeabi-v7a/build/python-installs/myapp/arm64-v8a/scrython/cards/__init__.py", line 1, in <module>
04-09 02:36:39.249 22155 23029 I python  :    File "/content/.buildozer/android/platform/build-arm64-v8a_armeabi-v7a/build/python-installs/myapp/arm64-v8a/scrython/cards/autocomplete.py", line 3, in <module>
04-09 02:36:39.249 22155 23029 I python  :    File "/content/.buildozer/android/platform/build-arm64-v8a_armeabi-v7a/build/python-installs/myapp/arm64-v8a/scrython/foundation.py", line 1, in <module>
04-09 02:36:39.250 22155 23029 I python  :    File "/content/.buildozer/android/platform/build-arm64-v8a_armeabi-v7a/build/python-installs/myapp/arm64-v8a/aiohttp/__init__.py", line 6, in <module>
04-09 02:36:39.250 22155 23029 I python  :    File "/content/.buildozer/android/platform/build-arm64-v8a_armeabi-v7a/build/python-installs/myapp/arm64-v8a/aiohttp/client.py", line 32, in <module>
04-09 02:36:39.250 22155 23029 I python  :    File "/content/.buildozer/android/platform/build-arm64-v8a_armeabi-v7a/build/python-installs/myapp/arm64-v8a/aiohttp/http.py", line 7, in <module>
04-09 02:36:39.250 22155 23029 I python  :    File "/content/.buildozer/android/platform/build-arm64-v8a_armeabi-v7a/build/python-installs/myapp/arm64-v8a/aiohttp/http_parser.py", line 15, in <module>
04-09 02:36:39.251 22155 23029 I python  :    File "/content/.buildozer/android/platform/build-arm64-v8a_armeabi-v7a/build/python-installs/myapp/arm64-v8a/aiohttp/helpers.py", line 607, in <module>
04-09 02:36:39.251 22155 23029 I python  :  TypeError: function() argument 'code' must be code, not str

I'm also including the declared requirements in the buildozer.spec file. I appreciate any help figuring this out!

# (list) Application requirements
# comma separated e.g. requirements = sqlite3,kivy
requirements = python3,kivy,aiohttp,multidict,attrs,yarl,async-timeout,charset-normalizer,idna,scrython

Edit: I have tried updating the requirements above with the specific version for each used in my Anaconda environment. No change in the error out.

Upvotes: 1

Views: 437

Answers (1)

Александр
Александр

Reputation: 417

It seems like an issue at import aiohttp as its' newer versions require newer versions of async-timeout that fails with the error (see the original comment by @csira).
To fix this issue I pinned the next versions in buildozer.spec:

requirements = python3, kivy, aiohttp==v3.7.4, aiosignal, frozenlist, async-timeout==3.0.1, attrs, charset-normalizer, multidict, yarl, idna, typing-extensions==4.4.0, chardet==4.0.0

Upvotes: 1

Related Questions