Generated ViewDataBinding class in Android Studio 3.2.1 has an error when view layout data variable type is contained in a subpackage
问题 I have my viewmodels contained in a "ViewModels" package. When setting one of them as a data variable type in my fragment layout xml file the generated ViewDataBinding class attempts to import the package as if it were a file. For example: import com.xyz.myapp.ViewModels; Rather than: import com.xyz.myapp.ViewModels.*; It then goes on to reference the viewmodel as ViewModels.MyFragmentViewModel causing further errors. I found that a workaround for this is to put all my viewmodel files in my