I had to adjust the cacerts file of the JDK used by Gradle. Which JDK is used by Gradle can be checked in Android Studio under File/Settings/Build, Execution, Deployment/Gradle.