javaandroidandroid-studioandroid-databinding

class NumberpickercustomlayoutBinding is public, should be declared in a file named NumberpickercustomlayoutBinding.java


I have enabled data binding in my android studio project. Whenever I build my project it shows this error:

" error: class NumberpickercustomlayoutBinding is public, should be declared in a file named NumberpickercustomlayoutBinding.java public final class NumberpickercustomlayoutBinding implements ViewBinding { "

It also gives me the path for the file but whenever I edit it according to the class name, it is regenerated again with the old name of the class and error is bing shown again error image.

I tried renaming it by following the link to the build folder, but on building the project it agains make the class name to initial name and the error still resides there.


Solution

  • You have to do the changes to file in the original library it is present in. As you can see in your image, it mentions "Files under the build "folder" are generated and should not be edited". During every build, an equivalent class of your original java file is generated.