Onesignal-android-sdk: Could not GET google maven2 onesignal-gradle-plugin metadata

Created on 11 Mar 2021  路  7Comments  路  Source: OneSignal/OneSignal-Android-SDK

   > Could not resolve gradle.plugin.com.onesignal:onesignal-gradle-plugin:[0.12.6, 0.99.99].
     Required by:
         project :
      > Failed to list versions for gradle.plugin.com.onesignal:onesignal-gradle-plugin.
         > Unable to load Maven meta-data from https://dl.google.com/dl/android/maven2/gradle/plugin/com/onesignal/onesignal-gradle-plugin/maven-metadata.xml.
            > Could not get resource 'https://dl.google.com/dl/android/maven2/gradle/plugin/com/onesignal/onesignal-gradle-plugin/maven-metadata.xml'.
               > Could not GET 'https://dl.google.com/dl/android/maven2/gradle/plugin/com/onesignal/onesignal-gradle-plugin/maven-metadata.xml'. Received status code 503 from server: Service Unavailable
   > Could not resolve androidx.navigation:navigation-safe-args-gradle-plugin:2.3.2.

All 7 comments

Could not resolve gradle.plugin.com.onesignal:onesignal-gradle-plugin:[0.12.6, 0.99.99].

@cuichanghao This can happen if you are missing or have added gradlePluginPortal() to the wrong spot. It should be under buildscript > repositories in your root build.gradle file.
Example:

buildscript {
    repositories {
        google()
        jcenter()
        gradlePluginPortal() // Ensure you have this
    }
}

Could not resolve androidx.navigation:navigation-safe-args-gradle-plugin:2.3.2.

I am not as sure about this one, but you maybe missing google() under allprojects, repositories and / or buildscript > repositories.
OneSignal does not use navigation-safe-args-gradle-plugin so you may need to check Google's docs on this one.

@jkasten2

What I'm trying to say is yesterday it's ok without gradlePluginPortal().
but today something wrong even add gradlePluginPortal.
it's failed when run Gitlab CI unit test.

repositories {
        google()
        mavenCentral()
        maven { url 'https://plugins.gradle.org/m2/'}
        jcenter() 
        gradlePluginPortal()
    }

@cuichanghao It seems odd you are getting a 503 on this URL, I get a 404 when testing in the Chrome browser.

https://dl.google.com/dl/android/maven2/gradle/plugin/com/onesignal/onesignal-gradle-plugin/maven-metadata.xml'. Received status code 503 from server: Service Unavailable

What version of gradle are you using in your project? I recommend 6.1.1.
- You can find this by opening the gradle/wrapper/gradle-wrapper.properties in your project.

In Gradle 6 they improved repositories error handling. In your case it seems Google's services hiccuped and resulted in Gradle giving up and not going to the next repo in the list due to getting a 5xx.

@jkasten2 Solved with clean before CI job run.
Thank you!

./gradlew clean

Today's error.
Cannot solve with ./gradlew clean.

> Could not resolve all artifacts for configuration ':classpath'.
   > Could not resolve gradle.plugin.com.onesignal:onesignal-gradle-plugin:[0.12.6, 0.99.99].
     Required by:
         project :
      > Failed to list versions for gradle.plugin.com.onesignal:onesignal-gradle-plugin.
         > Unable to load Maven meta-data from https://plugins.gradle.org/m2/gradle/plugin/com/onesignal/onesignal-gradle-plugin/maven-metadata.xml.
            > Could not HEAD 'https://plugins.gradle.org/m2/gradle/plugin/com/onesignal/onesignal-gradle-plugin/maven-metadata.xml'. Received status code 500 from server: Internal Server Error

may be related with jcenter Sunset?
https://jfrog.com/blog/into-the-sunset-bintray-jcenter-gocenter-and-chartcenter/

https://status.gradle.com Jcenter download is down.

@cuichanghao @hlongvu Looks like Gradle plugins, those available from gradlePluginPortal() or the URL plugins.gradle.org/m2 use JCenter on Gradle's servers per this note but will be migrating before the shutdown:

Impact to Gradle plugins
Behind the scenes, the Gradle Plugin Portal uses JCenter to resolve dependencies of plugins. We will be migrating the Plugin Portal away from JCenter before the final shutdown. Builds will not need to make changes while the Plugin Portal migrates away from JCenter.

https://blog.gradle.org/jcenter-shutdown#impact-plugins

This explain the reason why onesignal-gradle-plugin could not be found when JCenter was having issue even though it is hosted on the Gradle Plugin repo.

For com.onesignal:OneSignal (the SDK that gets included in your app) we have instructions to migrate to Maven Central today:
We have a migration guide on switching to Maven Central available now #1293.

Was this page helpful?
0 / 5 - 0 ratings