secrets-gradle-plugin icon indicating copy to clipboard operation
secrets-gradle-plugin copied to clipboard

Installation instructions throwing UnknownPluginException

Open doneill opened this issue 3 years ago • 10 comments

Installation calls for adding com.google.android.libraries.mapsplatform.secrets-gradle-plugin:secrets-gradle-plugin:1.3.0as a dependency classpath and com.google.android.libraries.mapsplatform.secrets-gradle-plugin to plugins block, this results in

Exception is:
org.gradle.api.plugins.UnknownPluginException: Plugin [id: 'com.google.android.libraries.mapsplatform.secrets-gradle-plugin'] was not found in any of the following sources:

- Gradle Core Plugins (plugin is not in 'org.gradle' namespace)
- Plugin Repositories (plugin dependency must include a version number for this source)

What has worked for me and is documented here and here is to add id "com.google.secrets_gradle_plugin" version "0.6.1" to the plugins dsl and not adding the dependency classpath.

The installation instructions are included in Maps SDK Quickstart and don't seem to be working as expected.

To reproduce:

doneill avatar Jun 24 '21 19:06 doneill

Hi @doneill, the instructions on the Maps SDK Quickstart and in this repo are the most up-to-date recommendation. The reason the plugin ID changed is because the plugin artifacts were migrated from Gradle Plugin Portal to Google Maven.

Can you share you project-level build.gradle file and your app-level build.gradle file here? Thanks

arriolac avatar Jun 24 '21 20:06 arriolac

Hi @arriolac, thanks for the quick reply. Maybe there is a hard requirement to have a project level build.gradle and app-level build.gradle as in my reproduction I have a single build.gradle, below is what works:

buildscript {

    repositories {
        google()
        mavenCentral()
    }

    dependencies {
		// ...
    }
}

plugins {
    id "com.google.secrets_gradle_plugin" version "0.6.1"
}

This throws the exception:

buildscript {

    repositories {
        google()
        mavenCentral()
    }

    dependencies {
        classpath "com.google.android.libraries.mapsplatform.secrets-gradle-plugin:secrets-gradle-plugin:1.3.0"
    }
}

plugins {
    id "com.google.android.libraries.mapsplatform.secrets-gradle-plugin"
}

Exception:

Exception is:
org.gradle.api.plugins.UnknownPluginException: Plugin [id: 'com.google.android.libraries.mapsplatform.secrets-gradle-plugin'] was not found in any of the following sources:

- Gradle Core Plugins (plugin is not in 'org.gradle' namespace)
- Plugin Repositories (plugin dependency must include a version number for this source)

doneill avatar Jun 24 '21 20:06 doneill

A couple things to try:

(1) Specify the version of the plugin in the plugins block and try to rebuild.

plugins {
    id "com.google.android.libraries.mapsplatform.secrets-gradle-plugin" version "1.3.0"
}

If that doesn't work, you may need to add the following in your settings.gradle file:

pluginManagement {
    repositories {
        google()
    }
}

Let me know if any of this resolves your issue.

As a side note, I'm curious why your project only has a single build.gradle file?

arriolac avatar Jun 24 '21 21:06 arriolac

Neither of those worked, I had tried using the version explicitly prior.

Single build file for single module project.

doneill avatar Jun 24 '21 23:06 doneill

Did you get a different exception?

arriolac avatar Jun 25 '21 00:06 arriolac

@doneill were you able to resolve this issue?

arriolac avatar Jul 07 '21 16:07 arriolac

Please reopen if you are still seeing this.

arriolac avatar Aug 09 '21 22:08 arriolac

Hi @arriolac Yes, I continue to get the exceptions I described in the description. The workaround I suggested still works so I apologize for moving on. If you want to continue to investigate the issue or cannot reproduce I can try to isolate outside of my project?

doneill avatar Aug 10 '21 18:08 doneill

Did you get a different exception?

No

Using groovy dsl

plugins {
	id "com.google.android.libraries.mapsplatform.secrets-gradle-plugin
}

results in

Plugin [id: 'com.google.android.libraries.mapsplatform.secrets-gradle-plugin'] was not found in any of the following sources:

Exception is:
org.gradle.api.plugins.UnknownPluginException: Plugin [id: 'com.google.android.libraries.mapsplatform.secrets-gradle-plugin'] was not found in any of the following sources:

- Gradle Core Plugins (plugin is not in 'org.gradle' namespace)
- Plugin Repositories (plugin dependency must include a version number for this source)

Adding a version results in

Exception is:
org.gradle.api.plugins.UnknownPluginException: Plugin [id: 'com.google.android.libraries.mapsplatform.secrets-gradle-plugin', version: '2.0.0'] 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.google.android.libraries.mapsplatform.secrets-gradle-plugin:com.google.android.libraries.mapsplatform.secrets-gradle-plugin.gradle.plugin:2.0.0')
  Searched in the following repositories:
    Gradle Central Plugin Repository

doneill avatar Aug 10 '21 21:08 doneill

It looks like Google Maven is not in the search path. Perhaps adding the following to your build.gradle file would do the trick?

buildscript {
    repositories {
        google()
        mavenCentral()
    }

    dependencies {
        classpath "com.google.android.libraries.mapsplatform.secrets-gradle-plugin:secrets-gradle-plugin:1.3.0"
    }
}

// ...and also the following
allprojects {
    repositories {
        google()
        mavenCentral()
    }
}

If you can also isolate outside of your project and share here that would be great so I can debug it on my end. Thanks

arriolac avatar Aug 11 '21 17:08 arriolac