Hello,
Welcome to our Microsoft Q&A platform!
I Fixed it by changing the name from android.support.v7.widget.Toolbar to androidx.appcompat.widget.Toolbar and this solved the issue.
The androidx.appcompat.widget.Toolbar
is targeted for higher android version.
You can try to set the android Target Frame
to higher version,for example android 10.0(Q)
.
Hope it can help you.
Best Regards,
Jessie Zhang
If the response is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.