I Compiled a Tauri App for Android, It Was Miserable

What the title says. Though I guess this blogpost isn't really about Android or Rust. I'm not exactly sure what I want to say here, just that I wanted to document my experience somewhere, and I didn't make a Mastodon thread for this.

I discovered Cinny, which is a Matrix client with a Discord-like UI. A Discord community I'm in has been experimenting with running a Matrix bridge to give a bit of an escape for those concerned by Discord's proximity to Persona and Palantir, which are US surveillance companies. Till recently, I have been using Fluffy Chat, though that left a lot to be desired, by dumping all rooms I am in, into a single homepage, making it so much more cluttered and overwhelming than the cleaner Discord UI, which keeps channels separated by the server they are from.

Discord-like UI in light mode, featuring servers in the leftmost sidebar, channels in the left sidebar, and channels shown in the middle area which would otherwise be messages

Cinny, at the time of writing, is available for install on Windows, MacOS, and Linux, while not yet on Android and iOS. However, just recently, it made the transition to Tauri v2 from v1. Tauri is a Rust framework which places itself as a replacement to the much heavier Electron, though still using web technologies to keep development simple.
The shift to Tauri v2 is interesting because v2 brought Android and iOS compatibility! So maybe in a few weeks, an official Cinny app will be released! That would be cool.

Alas, I do not want to wait. And the people on the Discord channel were pushing me to try compiling Cinny for mobile, given my experience with Rust. It might also have something to do with how much of a Rust stereotype I am as well, but I digress.

message from person called genesixx telling me to dev a rust mobile app, with me replying it crossed my mind but i can't do a better job than cinny
peer pressure

So that's the backstory.

My Experience

So I started by cloning the Cinny desktop app repo. It has the whole Tauri app, so let's try compiling, I guess? It seems as simple as running npm run tauri android build and installing the resulting apk file. How hard can it be, right?

For starters, I got an error about missing the Android SDK tools, which sent me on a quest to obtain Android Studio and install it with as few SDK components as I need to avoid downloading several GB of stuff. Just to clarify, at this point, that I was following along with the Tauri docs on Android development, and not just winging it from the compiler error messages.

I also had the option of either a virtual Android device or to connect a physical phone and turn on all the developer tools needed. I opted for the latter with my older Nokia 6.1+, running Android 10, tethered to my laptop over USB-C.

What followed was several hours of compilation attempts, as each compilation run gave new errors about features or components used in the desktop app which don't exist on Android. It was just a matter of temporarily disabling some of these features and restarting the compilation. One particularly disheartening run was when it finished compiling the app and was turning it into an apk file, then failed because my Java installation was too old. People like complaining about Rust compilation times, but that is absolutely nothing compared to what I endured with Tauri.
What was interesting is that my laptop wasn't under much load, per se. I am used to high CPU usage and RAM being filled, but outside of the initial compilation, my system remained on low 10% CPU usage and only 13GB RAM of 32.

picture taken of my phone, with my laptop screen behind. the laptop screen is blurred but shows a purple console, with some light text. in the foreground, my phone displaus "web page not available, cleartext not permitted"

After finally getting a successful compilation, I realised I had to sign it before being able to install it with adb. Sadly there was no --insecure flag to let me cut yet another corner. Then I was greeted with this, with the picture being taken from my other phone. I was happy, don't get me wrong, it had been hours and midnight had come and gone, but the application was there, just had to make it work!
It was a simple bypass, to allow cleartext, though I have since changed the port to 8080 with the hopes that it might help, somehow?

screenshot showing a mobile discord-like UI. The previous image is seen as being sent to the chat, though there's overlay by the android notif and menu bars which is making text hard to read

And now a screenshot from the actual running app, showing the chat I was narrating this experience into, to the enjoyment of whichever sadists were online. You'll undoubtedly notice that the notification bar and actions menu on the bottom are pretty obtrusive, and opening the keyboard hid the text box and some messages. This was the final fix of the day, adding resizing features to move everything up when the keyboard appears, and fullscreen to hide the bars on the top and bottom.

Now I have an apk file which can be installed on Android devices and is a really nice experience to interact with Matrix. My only gripe now is that android notifications don't work, but it's not that bad since Discord doesn't give me notifications either. Voila, what I mess around with till 2 in the morning!