Gradle - Add conditional classpath in buildscript dependencies
问题 I have updated to Android Studio 2.2, which uses by default the Gradle Plugin v2.2.0, and is much better for debugging purposes. For disribution purposes, I must still use v2.1.3. I was thinking of adding a conditional command in the project gradle script, but I am not sure how to do it. The following test works buildscript { repositories { jcenter() } dependencies { if (project.name.startsWith("X")) { classpath 'com.android.tools.build:gradle:2.1.3' } else { classpath 'com.android.tools