I'm moving away from using KotterKnife in my apps,...
# android
p
I'm moving away from using KotterKnife in my apps, since support and development was withdrawn a while ago. With ViewBinding still in Canary, what alternatives are you using, what are your recommendations?
j
It's in beta with RC around the corner
s
As Jake mentioned, it's still in beta. Alternatives could be Kotlin synthetic imports, but we've been using view bindings for a while in production with no issues. 😎
p
Yeah I've been using synthetics and it's been working fine, but it feels "unnatural" 😛 will be using it until view binding rc is released then, thanks guys! 👍
m
If you are just starting with the project then it will likely be in stable when you will be releasing, so using Viewbinding is fine.
p
I found that ViewBinding (beta4) isn't ready yet; it fails to compile if you have includes in your layout from other gradle modules
Also you have to restart AS after every layout change because it's not picking up new layouts
🚫 1
😯 1
j
The former is already fixed. They branched 3.6 after the change and then i went on leave for two months.
Never heard or seen the latter. File a bug.
m
you could start with the Data Binding library and not include variables in the xml, then the the main thing to change is the
<layout>
tag if/when you switch
💯 1
speaking of which, are there any plans to deprecate that library since the two are so similar? or just choose whichever works best for your needs?
p
Taken from the official docs: Differences from the data binding library View binding and the data binding library both generate binding classes that you can use to reference views directly. However, there are notable differences: The data binding library processes only data binding layouts created using the <layout> tag. View binding doesn't support layout variables or layout expressions, so it can't be used to bind layouts with data in XML. https://developer.android.com/topic/libraries/view-binding
m
yeah I was just saying hypothetically you could use data binding for only the autogenerated bindings and not mess with the xml expressions/binding adapters and get the same thing view binding gets you, not saying you should. guess that's why the view binding library exists. no idea how the autogen compares/if one is more performant than the other
p
i think data binding is a little heavier, dont remember where i saw that
j
it's heavier
⚖️ 2
For a good comparison between the different options
And personal recommendations
p
It's weird that it has entered RC 1 with vital stuff like this open: https://issuetracker.google.com/issues/142939794 Isn't RC mean to be "This might be finished and is a candidate for a release"?
s
I saw they fixed a number of things regarding view/data binding. Have you tried the RC and verified that yours is still an issue? Thinking it could be related to https://issuetracker.google.com/issues/140882631, perhaps, which is fixed in this RC. Could of course be very wrong, as well. 😅
p
Nope that's a different issue and the open issue is still reproducable on the rc1