Home » Android » maven – Ionic Gradle failure "Could not find com.android.tools.build:gradle:2.2.3"

maven – Ionic Gradle failure "Could not find com.android.tools.build:gradle:2.2.3"

Posted by: admin May 14, 2020 Leave a comment

Questions:

I am attempting, in Windows 7, to compile my Ionic project Android platform using the Ionic CLI. This is something that previously worked, and now does not. The only thing that has changed is that I upgraded Android Studio. However, I am not compiling with Android studio, so I am surprised that I am getting Gradle errors. For:

$ ionic run android

The output is:

A problem occurred configuring root project 'android'.
> Could not resolve all dependencies for configuration ':_debugApk'.
   > A problem occurred configuring project ':CordovaLib'.
      > Could not resolve all dependencies for configuration ':CordovaLib:classpath'.
         > Could not find com.android.tools.build:gradle:2.2.3.
           Searched in the following locations:
               https://repo1.maven.org/maven2/com/android/tools/build/gradle/2.2.3/gradle-2.2.3.pom
               https://repo1.maven.org/maven2/com/android/tools/build/gradle/2.2.3/gradle-2.2.3.jar
           Required by:
               android:CordovaLib:unspecified

Though the output claims that I can gain additional error info with the –stacktrace and –debug flags, this is untrue.

I have seen threads suggesting that the problem is that one or more of mavenCentral() or jcenter() are missing from the repositories list in the build.gradle. These are both present.

I tried just throwing an HTTP GET at the addresses and it comes back 404. Is there somewhere else that I can direct Gradle to look for these files?

Possibly the strangest thing is that the files that it claims it can’t find, actually do get downloaded into the Gradle cache each time (if I clear them, they appear the next time I execute the command). They appear in:

~/.gradle/caches/modules-2/files-2.1/com.android.tools.build/gradle/2.2.3/88b4934c958cfe74ff5559c1a33707a562af59d2/gradle-2.2.3.pom

and

~/.gradle/caches/modules-2/files-2.1/com.android.tools.build/gradle/2.2.3/7b8f79621d95e3ce1e95c0852db14d9d7e1d1951/gradle-2.2.3.jar

Steps I’ve taken so far:

  • upgrade Gradle
  • clear both gradle and Maven repositories
  • Try it off the company intranet with the --no-proxy flag on

I’m not sure what the next troubleshooting step should be.

How to&Answers:

I had same issue on mac, what worked for me was fresh install of android studio and ionic.
So probably first uninstall everything, then install android studio update it install whatever tools required, install gradle THEN install cordova and ionic.

Answer:

This is maybe due to the path.Ionic is not able to find the path of the sdks in the same folder as u are giving there in your environment variables .
Try to change environment variables. Maybe you have given a local path instead of global hence it was not able to find sdks of your android studio.