I have a project configured through the triple of:
Declare repository in top-level build.gradle:
buildscript { repositories { google() }} allprojects { repositories { google() }}
Declare classpath dependency, so plugin artifact gets downloaded from the appropriate repository, in top-level build.gradle
buildscript { dependencies { classpath 'com.android.tools.build:gradle:3.1.3' }}
Then, in the app build.gradle file, apply the plugin:
apply plugin: 'com.android.application'
I want to migrate this to use the new plugins DSL as enabled by the PluginsDependenciesSpec
.
I then:
Declared the repository in settings.gradle:
pluginManagement { repositories { google() }}
Declared the plugin dependency in the app build.gradle:
plugins { id "com.android.application" version "3.1.3" }
But this fails to resolve:
FAILURE: Build failed with an exception.
Where: Build file '…/build.gradle' line: 2
What went wrong: Plugin [id: 'com.android.application', version: '3.1.3'] was not found in any of the following sources:
Gradle Core Plugins (plugin is not in 'org.gradle' namespace)
- Plugin Repositories (could not resolve plugin artifact 'com.android.library:com.android.library.gradle.plugin:3.1.3')
Searched in the following repositories:
- BintrayJCenter
- maven(https://maven.fabric.io/public)
- Gradle Central Plugin Repository
What am I missing to get Gradle to connect the dots here, so that it can connect the plugin.id to the appropriate JAR fetched from the appropriate repository?