https://kotlinlang.org logo
#android
Title
# android
k

kartikpatodi

06/10/2018, 8:47 PM
when I try to use databinding it generates
android.support.constraint.ConstraintLayout
instead of
androidx
equivalent
r

rkeazor

06/10/2018, 10:26 PM
if your using databinding, why would you be using android-kotlin-extenstions
thats what its suppose to do
k

kartikpatodi

06/10/2018, 10:30 PM
It is a java + kotlin project
r

rkeazor

06/10/2018, 10:33 PM
yea but what is the point in using both?
i mean databinding , and the extentsions
k

kartikpatodi

06/10/2018, 10:35 PM
Well even though i remove extentions then also it should genetate classes with imports according to androidx namespace
For constraint layout
r

rkeazor

06/10/2018, 10:42 PM
gotcha, although, im not sure what you mean.. If your using kotlin extentsions , than it goes by ID. its not possible for you to just type an id and than it auto import an a view group
unless your id is ConstraintLayout
lol
although I wonder, if Databinding gives you the same capability🤔. can’t remember
k

kartikpatodi

06/10/2018, 10:44 PM
@rkeazor using databinging fir generating java class only... With daggr
r

rkeazor

06/10/2018, 10:44 PM
🤔
i have no idea what your talking about😂 what does dagger have to do with databinding.
k

kartikpatodi

06/10/2018, 10:47 PM
No prob let it be
r

rkeazor

06/10/2018, 10:50 PM
hehe just playing dude. if you post some sample code maybe it will give more context..
k

kartikpatodi

06/10/2018, 11:06 PM
i have no idea what your talking about😂 what does dagger have to do with databinding.
Sorry it is not.... mixed issues of two different projects maybe should take the day off
g

gildor

06/10/2018, 11:37 PM
Android Extensions is not replacement for Databinding library. Binding library can do much-much more than just search for views by id.
k

kartikpatodi

06/10/2018, 11:38 PM
@gildor can you explain the behavior in the main issue
g

gildor

06/10/2018, 11:39 PM
Actually really interesting issue. Do you use androidx.constraintlayout, but binding generates android.support? Do you use jettifier? Are you sure that it's not a problem of some of your binding adapters? I just don't think that binding library knows anything about Constraint Layout, maybe some bug of jettifier with code generation
If you have reproduction steps, please let me know, I would like to vote up this issue
I would like, but our app with bindings is not use androidx yet, but another app already on androidx without issues, but no bindings there
k

kartikpatodi

06/10/2018, 11:43 PM
actually i am not familiar with the data binding library I am trying to implement this codelab https://github.com/googlecodelabs/android-build-an-app-architecture-components
I bumped up the dependencies all the way to support AS 3.2-alpha17
and refactored to androidX
please try and let me know @gildor
also it is java and trying to convert to kotlin ass well 🙂
r

rkeazor

06/10/2018, 11:49 PM
Ohhh
wait a sec
are you trying to use extensions in Java?
k

kartikpatodi

06/10/2018, 11:50 PM
which extensions?
r

rkeazor

06/10/2018, 11:50 PM
androidx
k

kartikpatodi

06/10/2018, 11:51 PM
yes
r

rkeazor

06/10/2018, 11:51 PM
thats not possible , i believe
k

kartikpatodi

06/10/2018, 11:51 PM
but androidx and ktx are two different things I guess you are mixing these two
androidx can be used with both but ktx cannot
r

rkeazor

06/10/2018, 11:53 PM
‘kotlin-android-extensions’
k

kartikpatodi

06/10/2018, 11:53 PM
and thats also a different thing
r

rkeazor

06/10/2018, 11:53 PM
what
lol
r

rkeazor

06/10/2018, 11:56 PM
my bad i see , your saying that when your trying to import the constraint layout , it doesn’t show
as within the new package structure
k

kartikpatodi

06/10/2018, 11:57 PM
yes and btw android kotlin extention is
kotlinx
and not
androidx
r

rkeazor

06/11/2018, 12:08 AM
are you able to type the import in manurally
k

kartikpatodi

06/11/2018, 12:09 AM
yes but is says don't change the generated classes
r

rkeazor

06/11/2018, 12:40 AM
Did you do Refactor -> Refactor android x , in Android studio?
k

kartikpatodi

06/11/2018, 12:40 AM
Yes
r

rkeazor

06/11/2018, 12:42 AM
do you see, the constraint layout dependency when you do that?
it should give you the option to migrate.. If your still having a issue after that . than do file a bug report. its still fairly new
k

kartikpatodi

06/11/2018, 12:43 AM
It chanded the dependencies throughout the project but not in the generated classes
r

rkeazor

06/11/2018, 12:44 AM
just do a clean -> rebuild
k

kartikpatodi

06/11/2018, 12:44 AM
Did that
r

rkeazor

06/11/2018, 12:46 AM
generated classes from Databinding?
yea just file a report. of what your going thru
k

kartikpatodi

06/11/2018, 12:48 AM
Right
r

rkeazor

06/11/2018, 12:57 AM
also , make sure the support dependency isn’t in your build.gradle
g

gildor

06/11/2018, 1:09 AM
@kartikpatodi do you have own fork, refactored to androidx that I could try and reproduce your problem?
k

kartikpatodi

06/11/2018, 1:23 AM
wait
g

gildor

06/11/2018, 2:42 AM
@kartikpatodi No issue with androidx and constraint layouts. Just fix package name in layout xml
k

kartikpatodi

06/11/2018, 2:43 AM
Can you pr the changes if you have a working version
g

gildor

06/11/2018, 2:43 AM
This is PR with fix
k

kartikpatodi

06/11/2018, 2:45 AM
Thanks for your time
g

gildor

06/11/2018, 2:45 AM
See, DataBinding generate code from your layout file, so just uses packages from layout
also, androidx.constraintlayout 1.1.1 changed package name from
androidx.constraintlayout.widget
to
androidx.constraintlayout
k

kartikpatodi

06/11/2018, 2:47 AM
Oh I see thanks