The R2 value generated by butterknife in library is not the same as the R value.

one of my projects is like this

  • app (application)
  • login (library/application)

in login , I use the R2 value generated by butterknife , similar to R2.layout.login , which is copied and modified into a constant ( fainl ) from the R file of the login module.

now encounters a problem when login is no longer used as application , using libaray and then being dependent into the main project app .
this R2.layout.login does not have the same value as the generated R.layout.login .

what should I do, please?

this is the current R and R2

    1. login/R.layout.login     // androidgradle taskfinal 
    2. login/R2.layout.login     //butterknifepluginR
    3. app/R.layout.login       //androidgradle taskapk
    4. app/R2.layout.login      //butterknifeR

now the value of 1 and 2 is the same, the value of 2 used in my code,
3 and 4 are the same, which is really the value of the resource packaged into apk , because the value of 2 is not the same as here, so my code will report an error.

after trying, there is no way to solve it. I hope I can give a hint

Mar.18,2021
Menu