Open the project in Android Studio. click on AGP Upgrade Assistant. Once complete, the issue will be resolved.