Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Installation instructions throwing UnknownPluginException #31

Open
doneill opened this issue Jun 24, 2021 · 10 comments
Open

Installation instructions throwing UnknownPluginException #31

doneill opened this issue Jun 24, 2021 · 10 comments

Comments

@doneill
Copy link

doneill commented Jun 24, 2021

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:

@arriolac
Copy link
Collaborator

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

@doneill
Copy link
Author

doneill commented Jun 24, 2021

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)

@arriolac
Copy link
Collaborator

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?

@doneill
Copy link
Author

doneill commented Jun 24, 2021

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

Single build file for single module project.

@arriolac
Copy link
Collaborator

Did you get a different exception?

@arriolac
Copy link
Collaborator

arriolac commented Jul 7, 2021

@doneill were you able to resolve this issue?

@arriolac
Copy link
Collaborator

arriolac commented Aug 9, 2021

Please reopen if you are still seeing this.

@arriolac arriolac closed this as completed Aug 9, 2021
@doneill
Copy link
Author

doneill commented Aug 10, 2021

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
Copy link
Author

doneill commented Aug 10, 2021

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

@arriolac arriolac reopened this Aug 11, 2021
@arriolac
Copy link
Collaborator

arriolac commented Aug 11, 2021

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants