Advertisement does not exist in current context

This is my first time trying to enable ads in my game. I have my built platform set to Android and enable Ads services in Unity. I have also downloaded the Advertisement package from package manager. Still it shows this error
Things I have tried to solve the error -

  • Turning of ads service then saving project and then reopening unity and turning back ads service back on
  • Deleting the library folder and reopening Unity

Did you try regenerating C# project file and Solution file?

  • Exit the Unity editor application
  • Delete *.csproj and *.sln files in the root directory of your Unity project
  • Reopen the Unity project

Got the same issue… and it drove me mad after deleting the Library and enabling/disabling it several times…
Found out from the Package Manager the Advertisement package wasn’t even imported at all…
So I did and now all working fine.

Unity 2021.3.16f1.