4

I'm building a Kivy application for Android. When it is run on my Linux machine from terminal it works as expected. When it is built and deployed to Android it fails with the following error:

I/python  (14091):  Traceback (most recent call last):
I/python  (14091):    File "{project path}/src/app/.buildozer/android/app/main.py", line 2, in <module>
I/python  (14091):    File "{project path}/src/app/.buildozer/android/app/_app.py", line 9, in <module>
I/python  (14091):  ImportError: No module named app.ui.first_screen
I/python  (14091): Python for android ended.

The first_screen.py (and the accompanying first_screen.kv) does exist in the ui package, but it appears the import path is different from what I am expecting. How do I need to structure my imports to properly load on Android?

FluxIX
  • 325
  • 1
  • 2
  • 13

2 Answers2

0

You can try to add the path to your module to the sys.path.

But maybe... there's no such thing as app.ui.first_screen. Try to make it only ui.first_screen or go for this:

from .<file/folder in your app folder> import <something>
Peter Badida
  • 11,310
  • 10
  • 44
  • 90
  • 1
    since this would use relative imports, it will currently cause a different error on Android. I reported the issue (https://github.com/kivy/python-for-android/issues/840) on the project's bug tracker already, although there seems to be general strangeness with importing on Android. – FluxIX Aug 18 '16 at 16:11
0

INSTEAD of using buildozer method you can use Google colab Method

I had already Written an Answer How to use google colab here https://stackoverflow.com/a/67499611/15784274

Sorry i cant type another time

Raghav Bharathi
  • 107
  • 1
  • 5
  • Using a web-based tool like Colab isn't really a valid solution here. If the solution Colab uses under-the-hood was published as an answer, that would be a valid solution. – FluxIX Jun 07 '21 at 16:30