6

When i use ViewBinding, it always generate xxxxxBinding.

I know android use Android Gradle Plugin build apk with code and resources。

And they're going to split some task (or transform).

I know task(transform) will build some file into ./build .

But the ViewBinding makes me confused,He doesn't appear to be generating files(Because every time I create layout file, I can access it directly)(Or I can just delete the build folder and it won't be created again,But he can still get it right(No error) in the code)。

Were some files secretly generated?

If so, where will it be generated?

If not, how can I do the same? For example, use a markdown file to generate code in real time.

user9214779
  • 309
  • 2
  • 8
  • 1
    as you said xxxxxBinding will be created. There will be atleast 2 build folder for each android project. Did you delete the build folder in the root directory or inside app directory( here app is a module directory)?. For every build, xxxxxBinding will be generated – Raghul Vaikundam Dec 26 '19 at 13:34
  • 1
    There's new thing in Gradle called incremental processing & ViewBinding processes uses the same to generate files on the go. So whenever any layout file changes, it gets reflected to generate Binding class. – Jeel Vankhede Dec 26 '19 at 13:58
  • @VaikundamRaghul I delete the build folder inside app directory. `/app/build/` @JeelVankhede So, where can i spot this `Binding class`? Are them in some file ? – user9214779 Dec 27 '19 at 06:07
  • 1
    Generally Binding class can be found in `app/build/generated/data_binding_base_class_source_out/debug/out/com/example/package/databinding`. Here `com/example/package` refers to the package name `com.example.package`. Let me know if it is there – Raghul Vaikundam Dec 27 '19 at 06:20
  • @VaikundamRaghul I know there will generated Binding class, But when i delete that folder, I still can visit new layout's Binding class while there is no one build folder. – user9214779 Dec 27 '19 at 07:30
  • I know my expression must have been inaccurate. I'm very, very sorry – user9214779 Dec 27 '19 at 07:30
  • I now realize that my problem is actually that `R.laayout.xxx` can still be written in code without error even if the build folder is not there. – user9214779 Dec 27 '19 at 07:33

0 Answers0