I Rewrote My Flutter Radio App in Kotlin and Jetpack Compose. The Download Size Dropped by Almost 50
I build small Android radio apps. My main project is Tamil Vanoli (தமிழ் வானொலி).
The idea is simple: open the app, choose a radio station, and listen to music. No complicated features, no unnecessary screens. Just radio.
For years, I built these apps with Flutter, and honestly, it served me well. Having a single codebase was convenient. Hot reload made development faster, and creating regional versions of the app - Hindi, Malayalam, and others - was relatively painless.
But last month, I made a significant decision: I rewrote the entire application in Kotlin with Jetpack Compose.
Why leave a framework that had worked well for years? Was native Android development actually worth the effort? The answer became clearer after looking at the numbers.
In this article, I'll walk through why I made the switch, how I approached the rewrite, the architecture I ended up with, and what changed in the final APK and app experience.
Why I Started Questioning Flutter
It wasn't one major problem that pushed me toward Kotlin. It was several smaller frustrations that gradually added up.
- Audio Playback Is the Entire Product
A radio app isn't just another application with a few screens. Audio playback is its core functionality. Everything else comes second.
I needed reliable background playback, media notifications, lock-screen controls, Bluetooth integration, Android Auto support, and sensible recovery when an internet connection temporarily disappeared.
With Flutter, most of these capabilities depended on plugins. Plugins are useful, but every additional plugin introduces another layer between the application and Android's native APIs. When something goes wrong, debugging across those layers can become frustrating.
I wanted more direct control over Android's media functionality.
- Application Size Matters
Many of my listeners use budget Android devices. Storage space isn't always plentiful, and mobile data connections can be slow or unreliable. I had been trying to reduce the download size since version 3.3.1.
One limitation was difficult to avoid: the Flutter engine and compiled Dart code contributed approximately 7.5 MB of overhead. That was a substantial fixed cost for an application whose primary job was streaming internet radio.
I wanted to see how much smaller the application could become without carrying the Flutter runtime.
- Startup Time and Initialization
Flutter needs to initialize its engine before rendering the application interface. For a lightweight radio application, I wanted to minimize the amount of work required before users could interact with the home screen. It wasn't necessarily a deal-breaker, but it was another reason to explore native development.
- Native SDK Integration
The application also uses advertising and consent SDKs, including AdMob and Meta. These are native Android libraries. In Flutter, integrating them meant maintaining platform-channel communication and additional plugin dependencies. With Kotlin, I could integrate these SDKs directly into the Android application.
Eventually, I found myself asking a straightforward question: If this is an Android-only application that depends heavily on Android features, why am I adding another framework between the application and the platform?
That question started the rewrite.
The Most Important Rule: Don't Break Existing Users
Before writing any Kotlin code, I established one non-negotiable requirement: Version 4.0.0 must behave exactly like version 3.4.0.
I wasn't planning a redesign or a new product experience. I wanted the same application, rebuilt using a different technology stack.
That meant preserving:
- Existing screens and navigation.
- Advertising behavior and placement rules.
- User preferences and theme settings.
- Favorite radio stations.
- Recently played stations.
- Existing application behavior.
I also retained the original package name and signing key. This was important because I wanted the Kotlin version to be distributed as a regular Play Store update rather than requiring users to uninstall the old application and install a new one.
Migrating Existing User Data
The most sensitive part of the migration was user data. The Flutter version stored application preferences and favorites using its existing storage mechanisms. The new Kotlin application needed to understand that old data and migrate it safely.
On the first launch, the new application reads the previous Flutter app's stored data and imports:
- Favorite stations.
- Recently played stations.
- Theme preferences.
- Rate-app prompt state.
This was a particularly important step. Imagine opening a radio app after an update and discovering that all your favorite stations have disappeared. That's not the kind of first impression I wanted version 4.0.0 to create.
I treated migration as a core feature of the rewrite, not an afterthought.
The New Architecture: Kotlin, Compose, and Modular Development
Instead of moving everything into one large Android module, I decided to organize the application into smaller, independently maintainable modules.
Here's how the project is structured:
core:model- Plain Kotlin models without Android dependenciescore:data- Retrofit, Room, DataStore, and repository implementationscore:player- Media3 integration and audio playbackcore:ads- AdMob, Meta, and consent managementfeature:browse- Radio station browsingfeature:player- Now-playing interface and playback controlsfeature:settings- Application settings and preferences
I also use Hilt for dependency injection. The overall architecture follows a straightforward approach: Room acts as the local source of truth for cached station data. Repositories manage data access. ViewModels expose UI state. Jetpack Compose observes that state and renders the interface. Media3 handles playback independently of the UI.
Room Database: No More Waiting for the Network
One of the most noticeable improvements came from introducing Room. Previously, the Flutter version relied more heavily on fetching station data before displaying the home screen. This meant users could encounter a loading indicator while waiting for the network request.
Now, station information is cached locally in Room. When the application launches, the home screen can immediately display the previously cached station list while network updates happen separately.
It's a small architectural change, but it makes the application feel much more responsive.
Media3: Taking Control of Audio Playback
The biggest technical improvement was moving audio playback to Android's Media3 library. Instead of depending on multiple Flutter plugins to handle different Android media features, I now have a dedicated playback layer.
Media3 gives me a unified approach to:
- Background audio playback.
- Media notifications.
- Lock-screen controls.
- Bluetooth media buttons.
- Android Auto integration.
- Playback state management.
I also simplified the handling of interrupted streams. Previously, recovering from a failed stream could involve several layers of plugin behavior. Now, I use a small retry policy:
- Retry after one second.
- If that fails, retry after three seconds.
- If playback still fails, notify the user.
Because the logic lives in native Kotlin code, I can write proper unit tests around the retry behavior. That makes the playback implementation easier to understand and maintain.
The Benchmark That Surprised Me: Download Size Dropped Almost 50%
This was the result I was most interested in measuring. The application went from approximately 14.5 MB to 7.7 MB on the reference device when version 4.0.0 was released. That's a reduction of approximately 47%.
The change was immediately visible in the Google Play Console. I watched the download-size graph drop on the 19th and refreshed the page several times because I initially wondered whether I was looking at a reporting glitch.
Understanding Where the Size Reduction Came From
The interesting part wasn't just the final number. It was understanding why it happened. In the Flutter builds, approximately 7.5 MB came from native libraries, including the Flutter engine and compiled Dart code. In the Kotlin version, that entire Flutter-related overhead disappeared.
Of course, native Android development isn't free of dependencies. The Kotlin application uses Jetpack Compose, Media3, and other Android libraries. The code-related portion actually increased slightly, from approximately 6.4 MB to 7.5 MB. But that increase was nowhere near the overhead removed by eliminating the Flutter runtime.
The result was a much smaller application overall.
More Features Without Increasing Download Size
Another interesting observation came from the next two releases. Versions 4.1.0 and 4.1.1 introduced several additional features:
- A home-screen widget.
- A Quick Settings tile.
- Android Auto folder browsing.
Yet the application download size remained practically unchanged.
This was particularly satisfying. I had spent months trying to save individual megabytes in the Flutter version. After moving to Kotlin, I finally had more room to add functionality without constantly worrying about application size.
Note: These figures are measurements from my application's reported Google Play download-size data, not a universal comparison between Flutter and Kotlin applications.
Was Rewriting Everything Actually Worth It?
Looking back, I would say yes. But the benefits weren't limited to the download size.
What Improved for Users? The most obvious improvement is the smaller download. Going from roughly 14.5 MB to 7.7 MB makes a difference for users with limited data plans or slower internet connections.
Playback integration is also more straightforward. The application now supports Android Auto, and Bluetooth play controls can resume the last station even after the application has been killed.
The home-screen widget and Quick Settings tile also provide quicker access to radio playback without requiring users to open the application every time. These are meaningful improvements for an application designed around listening to audio.
What Improved for Me as a Developer? The biggest benefit is having direct control over Android functionality. I no longer need to maintain as much platform-channel glue for features that are fundamentally Android-specific.
The modular architecture also makes it easier to isolate functionality, test individual components, and introduce new features.
There's another benefit I didn't initially expect. I maintain multiple regional radio applications. Now that Tamil Vanoli is built on the new Kotlin foundation, I can use it as the template for the other applications. Instead of manually copying and modifying large amounts of code, I use a script to carry changes across the sibling applications. That makes maintaining the entire app family considerably easier.
Should You Switch from Flutter to Native Android?
I wouldn't recommend rewriting every Flutter application just because Kotlin is native. Flutter is an excellent framework, and for many applications, it is still a perfectly sensible choice.
If your application primarily consists of screens, forms, API calls, and conventional UI interactions, Flutter can be an excellent development platform.
But my experience taught me something important: The more deeply your application depends on platform-specific functionality, the more valuable native development can become.
In my case, audio playback, background services, notifications, Bluetooth integration, Android Auto, and native advertising SDKs were central to the product. I was spending time working around the framework instead of building the actual application.
Moving to Kotlin and Jetpack Compose simplified that relationship. The smaller download size was a great bonus, but having better control over the Android platform was the bigger reason I made the switch.
The Apps: Tamil, Hindi, and Malayalam Radio
The Kotlin rewrite started with Tamil Vanoli, but the same foundation is now being used across my regional radio applications. You can check them out here: Tamil Vanoli (தமிழ் வானொலி) Hindi Radio Malayalam Radio All three share the same Kotlin codebase foundation, with their own station lists and visual identity.
My Website: AwestruckTech
Final Thoughts
Rewriting Tamil Vanoli from Flutter to Kotlin was a bigger undertaking than I initially expected. There were migration challenges, architectural decisions, and plenty of opportunities to break existing functionality. But the result was worth it.
The application is now approximately half its previous download size, has better integration with Android media features, and has an architecture that is easier for me to extend and maintain.
If there's one lesson I'd take away from this experience, it's this: Choose your technology based on what your application actually needs, not just what makes the initial development easier. Flutter was the right choice when I started. Kotlin became the better choice as the application evolved.
I'd genuinely love to hear from other Android developers: Have you ever migrated an existing Flutter application to native Kotlin? What surprised you most during the process?
Thanks for reading!
Comments
No comments yet. Start the discussion.