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

Could not resolve com.google.android.gms:play-services-ads-identifier:[15.0.0, 16.0.99]. #248

Closed
rakib205 opened this issue May 21, 2020 · 9 comments

Comments

@rakib205
Copy link

rakib205 commented May 21, 2020

Description:

I am facing this error. I have checked the issues and no fix found.

Errors I have found :

FAILURE: Build failed with an exception.                                                                           
                                                                                                                   
* What went wrong:                                                                                                 
Could not determine the dependencies of task ':app:preDebugBuild'.                                                 
> Could not resolve all task dependencies for configuration ':app:debugCompileClasspath'.                          
   > Could not resolve com.google.android.gms:play-services-ads-identifier:[15.0.0, 16.0.99].                      
     Required by:                                                                                                  
         project :app > com.onesignal:OneSignal:3.13.2                                                             
      > Failed to list versions for com.google.android.gms:play-services-ads-identifier.                           
         > Unable to load Maven meta-data from https://storage.googleapis.com/download.flutter.io/com/google/android/gms/play-services-ads-identifier/maven-metadata.xml.
            > Could not get resource 'https://storage.googleapis.com/download.flutter.io/com/google/android/gms/play-services-ads-identifier/maven-metadata.xml'.
               > Could not GET 'https://storage.googleapis.com/download.flutter.io/com/google/android/gms/play-services-ads-identifier/maven-metadata.xml'.
                  > Remote host closed connection during handshake                                                 
   > Could not resolve com.google.android.gms:play-services-base:[10.2.1, 16.1.99].                                
     Required by:                                                                                                  
         project :app > com.onesignal:OneSignal:3.13.2                                                             
      > Failed to list versions for com.google.android.gms:play-services-base.                                     
         > Unable to load Maven meta-data from https://storage.googleapis.com/download.flutter.io/com/google/android/gms/play-services-base/maven-metadata.xml.
            > Could not get resource 'https://storage.googleapis.com/download.flutter.io/com/google/android/gms/play-services-base/maven-metadata.xml'.
               > Could not GET 'https://storage.googleapis.com/download.flutter.io/com/google/android/gms/play-services-base/maven-metadata.xml'.
                  > Remote host closed connection during handshake                                                 
      > Failed to list versions for com.google.android.gms:play-services-base.                                     
         > Unable to load Maven meta-data from https://storage.googleapis.com/download.flutter.io/com/google/android/gms/play-services-base/maven-metadata.xml.
            > Could not get resource 'https://storage.googleapis.com/download.flutter.io/com/google/android/gms/play-services-base/maven-metadata.xml'.
               > Could not GET 'https://storage.googleapis.com/download.flutter.io/com/google/android/gms/play-services-base/maven-metadata.xml'.
                  > Remote host closed connection during handshake                                                 
      > Failed to list versions for com.google.android.gms:play-services-base.                                     
         > Unable to load Maven meta-data from https://storage.googleapis.com/download.flutter.io/com/google/android/gms/play-services-base/maven-metadata.xml.
            > Could not get resource 'https://storage.googleapis.com/download.flutter.io/com/google/android/gms/play-services-base/maven-metadata.xml'.
               > Could not GET 'https://storage.googleapis.com/download.flutter.io/com/google/android/gms/play-services-base/maven-metadata.xml'.
                  > Remote host closed connection during handshake                                                 
   > Could not resolve com.google.firebase:firebase-iid:[17.0.4].                                                  
     Required by:                                                                                                  
         project :app > com.google.firebase:firebase-messaging:17.3.4                                              
      > Failed to list versions for com.google.firebase:firebase-iid.                                              
         > Unable to load Maven meta-data from https://storage.googleapis.com/download.flutter.io/com/google/firebase/firebase-iid/maven-metadata.xml.
            > Could not get resource 'https://storage.googleapis.com/download.flutter.io/com/google/firebase/firebase-iid/maven-metadata.xml'.
               > Could not GET 'https://storage.googleapis.com/download.flutter.io/com/google/firebase/firebase-iid/maven-metadata.xml'.
                  > Remote host closed connection during handshake                                                 
                                                                                                                   
* Try:                                                                                                             
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
                                                                                                                   
* Get more help at https://help.gradle.org                                                                         
                                                                                                                   
BUILD FAILED in 6m 13s   

My build.gradle

buildscript {
    ext.kotlin_version = '1.3.21'
    repositories {
        google()
        jcenter()
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:3.3.1'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
        classpath 'com.google.gms:google-services:4.3.2'
    }
}

allprojects {
    repositories {
        google()
        jcenter()
    }
}

rootProject.buildDir = '../build'
subprojects {
    project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
    project.evaluationDependsOn(':app')
}

task clean(type: Delete) {
    delete rootProject.buildDir
}
`

### My app level build.gradle

`buildscript {
    repositories {
        // ...
        maven { url 'https://plugins.gradle.org/m2/' } // Gradle Plugin Portal
    }
    dependencies {
        // ...
        // OneSignal-Gradle-Plugin
        classpath 'gradle.plugin.com.onesignal:onesignal-gradle-plugin:[0.10.2, 0.99.99]'
    }
}

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

def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
    localPropertiesFile.withReader('UTF-8') { reader ->
        localProperties.load(reader)
    }
}

def flutterRoot = localProperties.getProperty('flutter.sdk')
if (flutterRoot == null) {
    throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
}

def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
if (flutterVersionCode == null) {
    flutterVersionCode = '1'
}

def flutterVersionName = localProperties.getProperty('flutter.versionName')
if (flutterVersionName == null) {
    flutterVersionName = '1.0'
}

apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"

   def keystoreProperties = new Properties()
   def keystorePropertiesFile = rootProject.file('key.properties')
   if (keystorePropertiesFile.exists()) {
       keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
   }

   android {
    compileSdkVersion 28

    sourceSets {
        main.java.srcDirs += 'src/main/kotlin'
    }

    lintOptions {
        disable 'InvalidPackage'
    }

    defaultConfig {
        // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
        applicationId "mrblab.wallpaper_app"
        minSdkVersion 16
        targetSdkVersion 28
        multiDexEnabled true
        versionCode flutterVersionCode.toInteger()
        versionName flutterVersionName
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }

       signingConfigs {
       release {
           keyAlias keystoreProperties['keyAlias']
           keyPassword keystoreProperties['keyPassword']
           storeFile file(keystoreProperties['storeFile'])
           storePassword keystoreProperties['storePassword']
       }
   }
   buildTypes {
       release {
           signingConfig signingConfigs.release
           shrinkResources false
           zipAlignEnabled false
           minifyEnabled false
       }
   }
}

flutter {
    source '../..'
}

dependencies {
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
    implementation 'com.android.support:multidex:1.0.3'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'androidx.test:runner:1.1.1'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'
    
    
}

apply plugin: 'com.google.gms.google-services'
@gz-ang
Copy link

gz-ang commented Jun 17, 2020

I'm currently having the same issue, the app wouldn't even build. For my case this happens while I was trying to add firebase dynamic link service to my app. it will build properly if i disable the google service plugin at the app level gradle.

@rgomezp
Copy link
Contributor

rgomezp commented Nov 11, 2020

Howdy @rakib205 @gz-ang
Apologies for the delay. Are you still experiencing the issue?

Please also make sure you are using the latest version of the OneSignal Gradle Plugin

@enricobenedos
Copy link

I was experiencing this issue after updating to firebase_core: ^0.5.2+1 and firebase_analytics: ^6.2.0. I was able to build an appbundle on release mode but I was not able to debug the app on Android Simulator.

I solved as advised by @rgomezp updating from

classpath 'gradle.plugin.com.onesignal:onesignal-gradle-plugin:[0.12.6, 0.99.99]'

to

classpath 'gradle.plugin.com.onesignal:onesignal-gradle-plugin:[0.12.9, 0.99.99]'

in my app/build.gradle

@WaheedHussainHaans
Copy link

Changing onesignal gradle plugin version didnt work for me any solution to this please

@rgomezp
Copy link
Contributor

rgomezp commented May 5, 2021

Howdy @WaheedHussainHaans ,
Did you make sure to sync your gradle in Android Studio? Please provide more info

@doanbh
Copy link

doanbh commented Jul 8, 2021

Changing onesignal gradle plugin version didnt work for me any solution to this please

You can try https://stackoverflow.com/a/68295157/9405238

@MuhammedRefaat
Copy link

I've updated to the latest releases and tried all the offered solutions, nothing works, it was working before but suddenly that happened

@AteqEjaz
Copy link

Same issue for me - Not able to build at all even in debug mode

FAILURE: Build failed with an exception.                                
  • What went wrong:
    Could not determine the dependencies of task ':app:preDebugBuild'.

Could not resolve all task dependencies for configuration ':app:debugCompileClasspath'.
Could not resolve com.google.android.gms:play-services-base:[10.2.1, 16.1.99].
Required by:
project :app > com.onesignal:OneSignal:3.15.1
> Failed to list versions for com.google.android.gms:play-services-base.
> Unable to load Maven meta-data from https://google.bintray.com/exoplayer/com/google/android/gms/play-services-base/maven-metadata.xml.
> Could not get resource 'https://google.bintray.com/exoplayer/com/google/android/gms/play-services-base/maven-metadata.xml'.
> Could not GET 'https://google.bintray.com/exoplayer/com/google/android/gms/play-services-base/maven-metadata.xml'. Received status code 403 from server: Forbidden

  • Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

  • Get more help at https://help.gradle.org

@jkasten2
Copy link
Member

This is now fixed and is part of the OneSignal-Flutter-SDK 3.2.8 Release, this SDK no longer refers to jcenter() and uses mavenCentral() instead to solve this issue.

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

No branches or pull requests

9 participants