The simplest option is to just upgrade Android Gradle plugin as @viktorbenei linked: config update for NDK r18 by viktorbenei 路 Pull Request #5 路 bitrise-io/sample-apps-android-sdk22 路 GitHub
You may also need to add google()
repository to buildscript block if needed and upgrade Gradle wrapper if it is not compatible with desired AGP version: Android Gradle plugin release notes | Android Studio | Android Developers.
At the time of writing the current version is 3.2.1
but minimal supporting NDK r17+ is AFAIR 3.1.0
.