Android View Binding set Custom Generated package name

Default android generate (my package name is com.exaple) and it generate com.example.databinding.Activity

I have lots of classes that reference com.example.sample.databinding.Activity so i have to change com.example to com.example.sample to all my viewBinding it can be possible to change view binding configuration to generate viewBinding in com.exaple.sample package name ?

I googled but nothing will helped me


  • If I remember correctly your build.gradle contains a namespace, you can change it to: namespace 'com.example.example' (in the android block), and after that if you rebuild your project (and maybe restart the IDE, generating the binding classes sometimes can be annoying) should result in the desired behaviour