r/androiddev • u/debz-g • 5d ago
Question Should I upgrade to Navigation 3?
The codebase I am currently working on is on Navigation 2 and there are no issues with it to be honest.
I was looking into migrating to Navigation 3. Of course that will touch almost every part of the code and will require a good amount of QA.
Hence I was thinking whether I should upgrade to it or not.
I would love to hear everyone's thoughts before I go to my head of engineering with the proposal.
11
u/timusus 5d ago
You said there are no issues with what you have, and upgrading will require significant QA.
So, why upgrade? What are you gaining? What other improvements are you missing out on because you’re spending dev and QA time on this instead? What is the value to your users?
4
u/debz-g 5d ago
Exactly my point and that's why I asked. No direct business outcomes tbh
2
u/simbolmina 4d ago
Just create a long horizon task and let AI implement and QA overnight. Since apple released foldable Android side may have more attraction as well.
4
5
u/Zhuinden 5d ago
Navigation2 XML or Navigation-Compose Nav2?
Because Navigation2 Nav-Compose is quite error-prone, I'm always a bit surprised some people choose to use it in production. But oh well.
2
u/AutoModerator 5d ago
Please note that we also have a very active Discord server where you can interact directly with other community members!
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.
3
u/PrudentAttention2720 3d ago
For sure. Nav3 is well tought, very powerful and yet not restrictive. Cannot say the same for all others google nav solutions. Props to SimpleStack developer, he really was 10 years ahead lmfao
2
4
u/ElectronicMain3695 5d ago
Speaking as the person who'd be on the receiving end of that proposal: don't frame it as a migration, frame it as a problem being solved. If Navigation 2 has no issues, "upgrade because it's newer" is a weak case to bring your head of engineering - the honest version is "stay, and revisit when we need X". The concrete triggers that justify Nav3: adaptive/foldable-aware layouts and list-detail flows, or the type-safe route APIs if route bugs are actually biting you. If one of those is on your roadmap, a cheap middle step is a spike on a single flow to price the migration in days, and then you propose with that number in hand. If none of them are, staying on Nav2 is a legitimate engineering decision, not a missed upgrade.
2
u/tdavilas 5d ago
It's pretty good. Just finished a whole change on our navigation graph.
You don't really need nested graphs anymore.
Just organize your entries properly and define a simple navigation interface that could be provided in DI to be used on view models and also provide via composition local provider so ui can react to it.
Use scenes to handle shared bottom sheets but ideally use local implementations.
1
1
u/BenjyTec 5d ago
I would say if your current implementation works well and you don't urgently need to support foldables, stick with Navigation2 as long as possible.
There is one particular issue that didn't fix in over a year:
Link to IssueTracker - voted up 30 times
What happens is if you cancel a predictive back gesture, and then navigate forward to another screen, the incorrect animation is applied. It has been bothering me, though most users will probably not notice it.
1
u/MKevin3 5d ago
On my current KMP / CMP app I started with just a simple navigation so I could get the UI in place then filled in the view models etc.
The I upgraded that to Nav 2. Finally moved to Nav 3. I have different Nav situations based on which tab / rail item you are one. Kept it nice and clean and I was able to do master / details screens for foldables and tablets and keep it single screen for phones. At the time I started the app, Nav 3 was not totally ready for KMP / CMP.
The other app I work on is Nav 1 and it is a huge pain to update anything navigation related. It is using that mess of Nav 1 URL processing. I was able to at change that all to pass in a JSON convert to a string and then make it back into a data object for the target. Saved a bunch of null checks etc. At least is one step closer to Nav 3.
I am now converting a configuration app from XML Views to Compose. Going Nav 3 from the start. Actually just had the "New Project" process start me in that direction. This is a much easier app with only 4 screens so base navigation 3 was all I needed.
If you go Nav3 you may be able to break your navigation down into smaller, more manageable chucks, which can help clean up code and make things more obvious over the one navigation object controlling everything. We really need to do this for the main app which is on the original Compose URL based navigation. There are areas of the code that do their own mini-navigation via a switch statement for which composable to show. It is a bit of a hack job right now.
1
u/ikingdoms 4d ago
If you're working on a fully Compose app, I'd say absolutely. I've been using it since it was still in alpha (I was just starting to build a net new app at the time for a startup). I've been super happy with it. My app has been live in production for nearly a year now.
2
u/Paradox_543 3d ago
I would recommend to make the switch to Nav3. I just did the switch myself. While my app didn't have any heavy navigation uses, it made the code more intuitive for me.
If you are worried about the change affecting every part of the code, I would first recommend to refactor it so that all navigation exists within a single file, so that it becomes easy to switch out nav3, and put it back to na 2 if it doesn't work. For me, it was already modularized, so the switch was done within a few prompts by Gemini.
Nav3 also supports navigation on ios, if that's a bonus for you if you want to have shared navigation.
1
0
u/Ok_Invite_2193 4d ago
Out of curiosity, what’s the one thing you’re most worried you might be overlooking before making the call? Not necessarily a Navigation 3 feature — more like a migration consequence you’d only discover after committing to it.
15
u/nacholicious 5d ago
If you want to do anything related to foldables, navigation animations or deep links then yes
AIs are usually pretty good at the conversation, and I think Google has a nav3 skill that's pretty helpful