Finally solved it from this solution Camera, ImagePicker permission to access media. It had to do with permissions. For some odd reason, this line
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
vanished from AndroidManifest.xml
I added it back and the photo gallery now pops up.