When I first was building my Android Cordova app in Android Studio with Gradle 2.2.1, everything was fine.
Then I wanted to be able to also build the app with Cordova CLI, so based on the following document, I enabled Gradle for Cordova CLI: https://github.com/apache/cordova-docs/blob/master/docs/en/edge/guide/platforms/android/tools.md
That broke the build, both in Cordova CLI and in Android Studio, with the error: Could not create plugin of type 'AppPlugin'
The verbose output showed that Cordova downloaded Gradle 1.12 and created a gradle-wrapper.properties file in my project specifying 1.12 distributionUrl. After editing that property back to 2.21, I can build again in Android Studio. But everytime I run the Cordova CLI build, it sets it back to 1.12 and the build fails with the same error.
How do I make Cordova build with Gradle 2.21?