"export 'ɵɵinject' was not found in '@angular/core'
So apparently after wasting 1 hour on the same issue, it seems your angular version and the material version should be same i.e if your angular CLI version is 7, you should use material version 7.
Just change the dependencies "@angular/material" and "@angular/cdk" version to "7.3.7" and change "@angular/animations" to "7.2.15"
Hope this solves your problem.
The solution is to ensure all your packages are of the same versions.
Check Package.json file to find if the packages are on the same version.
Then in the command line use the command
ng update @angular/core
This should solve the problem
I have resolved it, I just updated the dependency of angular material to 7 and angular version to 7.3.2 and it worked.