Change Package Name after implementation of data binding

前端 未结 4 2216
慢半拍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:18

    I just bumped into the same issue. I was able to fix it by toggling databinding.enabled inside Build.gradle (Module). Below is a little step-by-step guide, that I went through after renaming my company package (com.abc.myapp -> com.xyz.myapp), which got databinding to work as expected:


    1. Build > Clean Project
    2. go to your Build.gradle (Module) and disable databinding:

      android { dataBinding { enabled = false } }

    3. File > Sync Project with Gradle Files

    4. Build > Rebuild Project (no surprise: you'll get a ton of error messages)
    5. Now enable databinding again:

      android { dataBinding { enabled = true } }

    6. File > Sync Project with Gradle Files

    7. Build > Rebuild Project


    Note: Some steps here may be unnecessary, but a little extra sanity checking has never done any harm during project setup, right!?

提交回复
热议问题