I was able to get past the error above.
I installed newer version of android studio.
Then installed from C:\Android\tools\bin\sdkmanager.bat the androidx.viewpager2/viewpager2.
I check to the right and installed.
now I am getting this error.
Generating R file. Error
c:\android\tools\..\extras\b4a_remote\com\google\android\material\material\1.1.0\unpacked-material-1.1.0\res\values\values.xml:1027: error: Error: No resource found that matches the given name: attr 'android:dialogCornerRadius'.
well I fixed this too.
I found an article on the site and said I had to change the path in my tools > configure paths.
replaced with below and now works.