I developed a kivyMD app specifically for android which is running great on windows as .py but when converted to apk using ubuntu on windows, its giving an error that:
/mnt/c/Users/Ayan/Documents/rackcalculator/.buildozer/android/build-arm64-v8a_armeabi-v7a/build/python-installs/rackcalculator/arm64-v8a/kivymd/material_resources.py, line 20, in <module>
AttributeError: 'NoneType' object has no attribute 'width'
Which is coming from kivyMD installed by buildozer.
I tried changing the code manually in material_resources.py and compiled it also. But still after running buildozer build it gives same problem. Clean build downloads the same material_resources.py with error.
Code that contains error is using kivy.core.window import Window
then Window.width
& Window.height
I can't be sure without looking at more of your code but it sounds like your code is trying to access Window properties &/or methods either before the Window has been created or after it has been deleted.
There are a number of points in the documentation for kivi.core.Window where things are mentioned as being desktop only but height & width are not amongst them they are however marked as AliasProperty
so actually make use of the setter/getter methods.
The
AttributeError: 'NoneType' object has no attribute 'width'
message tells me that at that point in the code your window variable is None - i.e. doesn't currently/yet exist.
Keep in mind that things like window creation may not always occur in at the same point between platforms & implementation.
The other possibility is that your Window creation is failing on android and returning a None
value.
For anybody experiencing the same sort of problem the OP did track down the cause of the failure to create the Window on Android - it was the use of setting an environmental variable to set a Kivi backend that was unsupported on the target platform.