Everything was fine until I upgraded Android Studio to Electric Eel | 2022.1.1 Patch 1. Without any code changes I can no longer build the project. In PhotoGalleryFragment.kt the import for com.bignerdranch.android.photogallery.databinding.FragmentPhotoGalleryBinding can’t be found: ‘databinding’ is now red and all references to FragmentPhotoGalleryBinding in this file are red and unrecognized. What is the solution please?
Android Studio Electric Eel and databinding
My first suggestion would be to follow the suggestions in the section titled “Build issues” in Chapter 5. If you are still running into issues after that, we can dig in a little further.
I probably failed to point out thatI have exactly the same issues when I load the provided code, downloaded from your site. I’m pretty sure that means it’s not my inability to type the code correctly.
I just did the same (using the solution at https://www.bignerdranch.com/android-5e-solutions) and I was able to successfully compile and run the app.
Did you make any changes to the project that you downloaded? I know that Android Studio can be pretty relentless in trying to get you to upgrade library versions.