2

I have set up the environment for compiling a Cordova Android app on my desktop and everything has worked fine. Then I compiled it on my laptop and I can't get it to compile the app.

I get this error

Could not find com.android.tools:common:25.2.3.
Searched in the following locations:
    https://jcenter.bintray.com/com/android/tools/common/25.2.3/common-25.2.3.pom
    https://jcenter.bintray.com/com/android/tools/common/25.2.3/common-25.2.3.jar
    https://maven.google.com/com/android/tools/common/25.2.3/common-25.2.3.pom
    https://maven.google.com/com/android/tools/common/25.2.3/common-25.2.3.jar
Required by:
    project : > com.android.tools.build:gradle:2.2.3 > com.android.tools.build:gradle-core:2.2.3 > com.android.tools.build:builder:2.2.3
    project : > com.android.tools.build:gradle:2.2.3 > com.android.tools.build:gradle-core:2.2.3 > com.android.tools.build:builder:2.2.3 > com.android.tools.build:manifest-merger:25.2.3
    project : > com.android.tools.build:gradle:2.2.3 > com.android.tools.build:gradle-core:2.2.3 > com.android.tools.build:builder:2.2.3 > com.android.tools.ddms:ddmlib:25.2.3
    project : > com.android.tools.build:gradle:2.2.3 > com.android.tools.build:gradle-core:2.2.3 > com.android.tools.build:builder:2.2.3 > com.android.tools.analytics-library:shared:25.2.3
    project : > com.android.tools.build:gradle:2.2.3 > com.android.tools.build:gradle-core:2.2.3 > com.android.tools.build:builder:2.2.3 > com.android.tools.analytics-library:tracker:25.2.3
    project : > com.android.tools.build:gradle:2.2.3 > com.android.tools.build:gradle-core:2.2.3 > com.android.tools.build:builder:2.2.3 > com.android.tools:sdklib:25.2.3 > com.android.tools.layoutlib:layoutlib-api:25.2.3
    project : > com.android.tools.build:gradle:2.2.3 > com.android.tools.build:gradle-core:2.2.3 > com.android.tools.build:builder:2.2.3 > com.android.tools:sdklib:25.2.3 > com.android.tools:dvlib:25.2.3
    project : > com.android.tools.build:gradle:2.2.3 > com.android.tools.build:gradle-core:2.2.3 > com.android.tools.build:builder:2.2.3 > com.android.tools:sdklib:25.2.3 > com.android.tools:repository:25.2.3

and this is my build.gradle

apply plugin: 'com.android.application'

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


    dependencies {
        classpath 'com.android.tools.build:gradle:2.2.3'
    }
}

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

task wrapper(type: Wrapper) {
    gradleVersion = '2.14.1'
}
Ishaan Javali
  • 1,711
  • 3
  • 13
  • 23
Valentin Garcia
  • 485
  • 6
  • 17
  • Share your app level build.gradle, my guess is that you have a different version like 28.0.0 – Fuel Dec 08 '18 at 03:55
  • Watching. I have the same issue, related to adding react-native-image-picker: Could not resolve all files for configuration ':react-native-image-picker:classpath'. – mediaguru Dec 08 '18 at 14:30
  • Same issue with Cordova.. – Towfiq Dec 08 '18 at 14:32
  • Can you guys please try the fixes mentioned in this thread and let us know if any of them work: https://stackoverflow.com/q/53677823/391955 – Towfiq Dec 08 '18 at 15:27

3 Answers3

5

For Cordova Users

Been struggling with this the whole day. This was happening for fresh cordova android project. Here is how I fixed it:

From your project folder navigate to platforms/android/cordovaLib and open up the build.gradle file and replace this line:

classpath 'com.android.tools.build:gradle:2.2.3'

with:

classpath 'com.android.tools.build:gradle:2.3.0'

Then open up the build.gradle file from the platforms/android/folder and make the above change too. And then replace:

 maven {
     url "https://maven.google.com"
 }

with:

mavenCentral()
Towfiq
  • 397
  • 5
  • 16
  • Thanks! this solved the problem but it didn't work the first time, I had to change the gradle version from 2.2.3 to 2.3.0 manually in the platforms/android/build.gradle and then it worked – Valentin Garcia Dec 08 '18 at 18:20
  • Hi. In my case this causes to error - Failed to resolve: com.google.android.gms:play-services-vision:11.8.0 – Rob Dec 10 '18 at 07:05
  • Rob, In that case, try adding `maven { url "https://maven.google.com" }` alongside `mavenCentral()` – Towfiq Dec 10 '18 at 07:07
  • Thanks Towfiq. It also causes an error- Could not find play-services-tasks-license.aar (com.google.android.gms:play-services-tasks-license:11.8.0). But after swaping it with jcenter() it works. Here is the link - https://stackoverflow.com/questions/52987790/could-not-find-play-services-tasks-license-aar-com-google-android-gmsplay-serv – Rob Dec 10 '18 at 07:10
1

I had same problem. Someone has removed the 25.2.3 jar/pom from jcenter repository.

I did a temporary fix by using gradle 3.1.4 instead of 2.2.3 and adding google() to the repository as below:

apply plugin: 'com.android.application'

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

    dependencies {
        classpath 'com.android.tools.build:gradle:3.1.4'
    }
}

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

task wrapper(type: Wrapper) {
    gradleVersion = '2.14.1'
}
Bharat Biswal
  • 1,755
  • 2
  • 15
  • 23
  • Did not work for me. Still having the same issue. Whats your gradle version in gradle-wrapper.properties ? – Towfiq Dec 08 '18 at 12:30
0

My problem was with react-native-image-picker. I found a fix on their github as follows, in the build gradle of react-native-image-picker in the node modules folder:

buildscript {
    repositories {
        google()
        jcenter()
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:3.1.4'
    }
}

https://github.com/react-native-community/react-native-image-picker/issues/999

mediaguru
  • 1,807
  • 18
  • 24