Change Package Name after implementation of data binding

前端 未结 4 2252
慢半拍i
慢半拍i 2021-02-20 00:55

I\'m using Databinding with one of my project with project name com.abc.def. I\'ve related all my views with binding like

Acti         


        
4条回答
  •  走了就别回头了
    2021-02-20 01:11

    first of all, did you changed package name only in Manifest? note that it could be different to applicationId - so you can only change it and leave app package as it was.

    RCA: probably OS you are using to build is case-insensitive but java compiler is - that's reason why it can't find classes. Bindings are generated alongside other generated classes (for example dagger 2 classes generated by annotation processor), each generator creates own files within folder structure that reflects class package BUT if packages differ only with big/small letters, second generator will use same folder with wrong name. The reason is if OS is case-insensitive it assumes that folder already exist but java compiler not.

    Other solution (except leaving app package as it is) is to :

    • rename all packages in app to other that differ to app package or to use OS that is case-sensitive (macOS could be formatter this way or linux)

提交回复
热议问题