Muhamet Aljobairi
Muhamet Aljobairi

Reputation: 1638

Flutter Onesignal Could not resolve com.google.firebase:firebase-messaging

I'm trying to run my flutter application after added onesignal_flutter: ^3.2.8 on my pubspec.yaml. I got this error:

Running Gradle task 'assembleDebug'...

FAILURE: Build failed with an exception.

Could not resolve all files for configuration ':app:debugRuntimeClasspath'. Could not resolve com.google.firebase:firebase-messaging:{require [19.0.0, 22.0.99]; prefer 22.0.0}. Required by: project :app > project :onesignal_flutter > com.onesignal:OneSignal:4.6.6 > Failed to list versions for com.google.firebase:firebase-messaging. > Unable to load Maven meta-data from https://google.bintray.com/exoplayer/com/google/firebase/firebase-messaging/maven-metadata.xml. > Could not get resource 'https://google.bintray.com/exoplayer/com/google/firebase/firebase-messaging/maven-metadata.xml'. > Could not GET 'https://google.bintray.com/exoplayer/com/google/firebase/firebase-messaging/maven-metadata.xml'. Received status code 502 from server: Bad Gateway

BUILD FAILED in 2m 47s [!] Gradle threw an error while downloading artifacts from the network. Retrying to download... Exception: Gradle task assembleDebug failed with exit code 1```

Upvotes: 0

Views: 480

Answers (1)

Varun Kumar
Varun Kumar

Reputation: 562

Add the following lines to your android/app/build.gradle

    buildscript {
      repositories {
         // ...
         mavenCentral()
      }
      dependencies {
        // ...
        // OneSignal-Gradle-Plugin
       classpath 'gradle.plugin.com.onesignal:onesignal-gradle-plugin:[0.12.10, 0.99.99]'
      }
    }

   apply plugin: 'com.onesignal.androidsdk.onesignal-gradle-plugin'

You can also refer to One Signal documentation for more info.

Upvotes: 0

Related Questions