The android example in SFML 2.6 doesn't really support recent Gradle versions out of the box.
One thing you can still try is changing the classpath to
com.android.tools.build:gradle:7.4.1
In SFML 3 the android example was updated to use more modern versions (and it also comes with a gradlew.bat file that you can use instead of using gradle directly, so that you can always build with the correct version no matter which version you have installed).