Where is ViewBinding GeneratedCode
Asked Answered
K

5

11

How/Where Can I find the generated code for ViewBinding?

whenever I try control+click/control+b to see the declaration, AndroidStudio just opens the XML layout.

Kasiekask answered 2/3, 2020 at 21:36 Comment(0)
I
23

The generate binding classes reside in app > build > generated > data_binding_base_class_source_out > debug > your app package > databinding

A you can see in the following screenshot all my ViewBinding classes for XML layout are inside the above path

Screeen shot of generated classes path

Illconditioned answered 3/3, 2020 at 9:33 Comment(4)
@seyedJafari you need to build the project then after that, you will find it there.Illconditioned
After trying everything I figured it's a problem of AndroidStudio canary4.0 updated to 4.1 and now can find itKasiekask
@Somesh Kumar How do I get to the Android Studio screen you show above? In the Project section of the Tool Window, when I select "Packages" or "Project Files" I am not able to see build > generated > etc... Any thoughts?Inquisition
@Inquisition You need to make sure you can build your project successfully. Go to Build > Rebuild Project. If it builds successfully you will get the above result ONLY in Project view and not in Packages or Project Files.Illconditioned
C
4
  1. open terminal enter image description here

  2. type find . -iname "*binding.java"

enter image description here

Chappy answered 26/5, 2021 at 2:17 Comment(0)
C
1

You can use the Ctrl + Shift + N (Go to file) to find the file with BindingImpl suffix.

Carruth answered 3/3, 2020 at 6:29 Comment(2)
it does not find the file I have tried all the search options in ASKasiekask
Navigation in AS only worked for me after I marked the app/build/generated directory as "Generated sources root" (right click on the directory > Mark directory as...)Randee
L
0

The name of the generated class for your_layout.xml is YourLayoutBindingImpl.java. so you can find the implementation using double-shift.

Lunge answered 2/3, 2020 at 21:48 Comment(3)
I think it's YourLayoutBinding.java. And can not find it in any search option of AndroidStudioKasiekask
it is possible to use double-shift. if you can't find it you must rebuild the projectLunge
The double shift won't find the generated files in the build folder. It finds only the files that are in the project view. @RaminAbdolmalekiIllconditioned
G
0

The name of the generated class for my_layout.xml is MyLayoutBinding.java. so you can find the implementation in MyProject/app/build/intermediates/javac/googleDebugStage/classes/you_package/databinding

Garnett answered 31/1 at 19:10 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.