Does anyone else have near constant problems with ...
# android
a
Does anyone else have near constant problems with Viewbinding/navigation components and Android Studio not recognizing the generated Kotlin code?
c
I've had some problems seemingly after adding viewBinding, but typically a clean would do the trick. Also assuming you used
<FragmentContainerView
as the host?
a
ahh is that related? I was just using Fragment
which did work but gave me compiler warnings
c
Oooh! According to Ian you have to use FragmentContainerView
Because <fragment isn't really a view and so it messes a bunch of things up.
a
lol OK. /shrug Android amirite?
thanks!
c
I recently enabled VB because FCV is now finally a thing.
I tried VB when it was brand new and it just wouldn't work with
<fragment
a
ah ok. I was blaming that on the gradle plugin
c
Once I moved over to FragmentContainerView the only issue that was kind of a bummer was https://issuetracker.google.com/issues/142847973… but thankfully it's starting to appear towards the top of google searches.
a
but yeah even in 3.6.2 was seeing issues with <fragment>
c
Hm. @Ian Lake ^? The issuetracker is showing private?
Anyway, the issue I was getting was at runtime, it didn't like that in my activity I think I was calling getNavController or one of those convenience methods, and it didn't work. If you search for that runtime crash, you should get an SO link to point you in the right direction. But yeah, that was my only real issue with getting VB started. That... and I had a couple of include and merge tag issues that weren't exactly clear, but now that I have VB. It's amazing.
Also, you probably saw it, but doing the whole VB dance in a fragment kinda sucks. Its ugly. @evant got a nice shoutout in this issue I filed https://issuetracker.google.com/issues/152333892
using a delegate makes it quite nice at the call-site
c
I did see like 5 different solutions so far. I also saw one interesting one that jw seemed to like where you use the views tag. But I do like evans article. I think trying to limit view interactions to onCreateView and not holding onto the field is where I'd ultimately love to go.
i
FWIW, it is the ... that is throwing off your link to the issue, it works when you go to https://issuetracker.google.com/issues/142847973
c
Thanks Ian. That's what I get for copy pasting from twitter.