Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Could not find any matches for com.android.tools.build:gradle:+

I'm trying to build/run an ionic project but from today this error comes up and I could not find any answer. Please, help me.

Error: Could not find any matches for com.android.tools.build:gradle:+ as no versions of com.android.tools.build:gradle are available.

  • Ionic Version: 4.5.0
  • Cordova: 6.5.0
  • NPM: 6.4.1
  • Gradle: Gradle 4.10.2

  • Kotlin DSL: 1.0-rc-6

  • Kotlin: 1.2.61
  • Groovy: 2.4.15
  • Ant: Apache Ant(TM) version 1.9.11 compiled on March 23 2018
  • JVM: 1.8.0_191 (Oracle Corporation 25.191-b12)
  • OS: Windows 7 6.1 amd64
like image 789
Enzo Gerola Avatar asked Dec 10 '18 20:12

Enzo Gerola


3 Answers

On my specific case the problem was with fcm plugin, this was what I did:

  • In platforms/android/build.gradle check buildscript gradle classpath version, my case was 2.2.3 (com.android.tools.build:gradle:2.2.3)

  • Then, in platforms/android/cordova-plugin-fcm/XXXX-FCMPlugin.gradle change classpath 'com.android.tools.build:gradle:+' to the same version found above: classpath 'com.android.tools.build:gradle:2.2.3'

That's it, fixed for me.

like image 80
Niroog Avatar answered Oct 22 '22 22:10

Niroog


On my case i had this issue with the phonegap push plugin. I followed @Niroog solution and and was able to solve it. Here is what i did:

  • In platforms/android/build.gradle my gradle classpath version was 2.2.3
  • I changed "classpath 'com.android.tools.build:gradle:+' in "platform/android/phonegap-plugin-push/****-push.gradle" to "com.android.tools.build:gradle:2.2.3'" under dependencies

I saved and ran cmd "ionic cordova build android -prod" in terminal and it built successful.

like image 39
Kowsik Paduchuri Avatar answered Oct 22 '22 21:10

Kowsik Paduchuri


Facing the same issue since earlier today. The solutions above didn't work for me. Came across another thread here...
https://forums.adobe.com/message/10804391#10804391

This one didnt work as well.Maybe I am doing something wrong..

----------EDIT-----------

Here is what worked for me

1) update build.gradle

buildscript {
repositories {
    google()
    jcenter()
    maven {
        url "https://maven.google.com"
    }
}..... 

allprojects {
repositories {
    jcenter()
    maven {
    url "https://maven.google.com"
     }
}}

2) update cordova-plugin-fcm/xxxxxx-FCMPlugin.gradle

repositories {
        google()
        jcenter()
        mavenLocal()
    }

Inspired from: https://developer.android.com/studio/releases/gradle-plugin

like image 3
Arjun Shankar Avatar answered Oct 22 '22 22:10

Arjun Shankar