2

today I woked up to the morning when I can not run my Ionic project like I was able a few hours ago.

$ ionic cordova run android --device -lsdc

gives:

[cordova]  FAILURE: Build failed with an exception.
[cordova]  
[cordova]  * What went wrong:
[cordova]  A problem occurred configuring root project 'android'.
[cordova]  > Could not find play-services-basement.aar (com.google.android.gms:play-services-basement:15.0.1).
[cordova]    Searched in the following locations:
[cordova]        https://jcenter.bintray.com/com/google/android/gms/play-services-basement/15.0.1/play-services-basement-15.0.1.aar
[cordova]  
[cordova]  * Try:
[cordova]  Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
[cordova]  
[cordova]  BUILD FAILED

I have tried to delete Android platform, didn't help.

$ cordova -v
8.1.2 (cordova-lib@8.1.1)

please, suggest what should I do to run the project again.

greengold
  • 1,184
  • 3
  • 18
  • 43

2 Answers2

2

I temporary fixed it moving jcenter() in the build.gradle file to the bottom of the parameters (see Android gradle Failed to resolve: play-services-basement) e.g. i changed this:

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

to this:

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

before it was in the first line - therefore it cannot find the basement file.

Rene
  • 41
  • 4
  • yeah, that too. then your project runs? – greengold Oct 25 '18 at 15:29
  • yes - the project runs after you change the order of the repositories - just be sure that jcenter() is at the bottom. – Rene Oct 29 '18 at 07:02
  • i just found out that in cordova android version 7.1.1 release notes they say: "(android) Move google maven repo ahead of jcenter" -> so if possible, just update your android version :) – Rene Oct 29 '18 at 07:30
  • I did, but I had another issue after that with inapppurchases, so I had to change package to this one: https://www.npmjs.com/package/cordova-plugin-inapppurchase-fixed – greengold Oct 29 '18 at 16:09
0

What version is your Android Cordova platform? I just got this same error on Cordova 8.1.2, but after updating my Android platform from 7.0.0 to 7.1.1 (the latest as of this writing) I was able to build successfully.

cordova platform list

cordova platform remove android
cordova platform update android
cordova platform add android
Jon W
  • 34
  • 1
  • 3