Beeware it is - My Android Learning Journey
I always had this doubt - be it Visual Studio, XCode or even C++ - what exactly is in it which is taking more than 2 GB of disk space and clogs your system memory? While at least, they allow your system to work, development in Android is an even bigger horror show. There are four major flavours of Android development - Kotlin/Flet, C#, React Native and Python. Let’s look at the advantages and disadvantages before jumping into Beeware.
Before going even into that, let’s look at the biggest challenge Android ecosystem has got - tooling and emulation. Android Studio is a real horror show to use. In fact, it is that avoided by a serious developer that you will never see a Kotlin course on Android Studio! It’s always IntelliJ Idea. There are three dimensions of the problem - the performance issues Android Studio as a software causes, the horrible tooling time and the resource intensive emulation process. Even an 16 GB RAM system will struggle to give a seamless development experience. This problem will really hurt you when you use Kotlin, Flet and even C# which requires Android Studio at least as a backend. I literally had to give up C# and Kotlin based Android development because my system refused to cooperate. I literally wasted days on doing the groundwork before realizing making Android Studio work is a near impossible task.
If one looks at it, Python has three options - Flet, Kivy and Beeware. Kivy is the most mature and stable, Flet has got the best development experience but both of them use their own widgets. Beeware tries to leverage the operating system’s UI elements. I started with Flet. The development experience was superb till - I tried to package it. The standard problems with Android tooling are it’s support, OS support and stability. Flet tooling works only for native python packages and not for C packages like Pandas. The recommendation is to use Kivy ecosystem to address this. After struggling for days to get things done, I had to give up. Even building a Windows app turned out to be a pain. Standard tooling, serious-python, Buildozer based approach - nothing worked.
Then, I tried C#. Performace issues. Then I decided it’s better I go to Kotlin as that is the main language for Android development. I was really unhappy I wasn’t able to make it work - Kotlin was my window into Java world and it will have to wait for another opportunity. The next best option is Flutter. But then, bad news, just now I was about to start working on Flutter(I had some exposure before) - Google’s new love for Flutter.
So, I decided to ditch the project for good. But, at some point, it was nagging me. I jumped to Kivy. I didn’t complete the project in Kivy. But, there is a problem. You will have to do it on Linux with Buildozer - either Colab or WSL. It took 35 minutes each time a minimum on Colab but then, at some point, it too, started throwing errors. A part of that is tooling related and a part of that is the packages I used.
At this point, I threw away the project - it’s turning out to be a complete waste of time but, vanity!! I decided to take one final look - Beeware. In fact, Beeware’s Toga turned out to be much simpler to use than even Flet and as the code is already available for Flet, all I had to do was to port it to Toga. But, wary of wasting time on that, I first decided to build the apk with the packages I wanted and some part of the code. It took 25 minutes for android build but it worked. At least, it worked!! But, updating package took less than a minute. A really good thing I would say. But then, there is another problem. Toga is not as sophisticated as Kivy or Flet. In fact, this is how a data table looks like in Toga!!
But, at least, there is a crude workaround - hard declaring the width as a multiple of number of characters.
style=Pack(flex=1, width=table_output_length(other_options)),
----------------------------------------
def table_output_length(df):
df = df.astype(str)
largest_column = df.applymap(len).max().idxmax()
max_length = df[largest_column].astype(str).map(len).max()
width = 5 * int(max_length) * int((len(df.columns) + 1))
return width
By the way, I literally sweated blood to make the Reset button work. It worked in Kivy and I need to think hard on that. Now, the only alternate available is to shutdown the app and use it.
This is how the android version looked like. Clean enough, I would say!
The dropdown list needs some working and scroll bar is a decent alternative for autowrap, but, at least, I have a working, presentable application.
In retrospect, what does this mean? Flet and Kivy focussed on development experience but not on the closing step - converting the package into a proper end product. Beeware focussed on the reverse - they made the closure their priority and didn’t focus on developer experience much and this, though painful, you will learn to live with it - your own alternates. My personal preference? Go for Beeware blindly. It’s much easier to rewrite your code in Kivy or even in C# for Windows if you find the WinForms frontend too crude for your use. But, yes. Remember, Python has a problem with scale. At a starter level, Python is great, but only till a level. And I am going to leverage Beeware for everything from now on.