ionic cordova play-services-basement-15.0.1.aar

2019-05-18 21:56发布

问题:

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.

回答1:

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


回答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.