今天,当我无法像几个小时前一样运行Ionic项目时,我醒来了。
$ ionic cordova run android --device -lsdc
给予:
[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
我试图删除Android平台,没有帮助。
$ cordova -v
8.1.2 (cordova-lib@8.1.1)
请提出我该怎么做才能再次运行该项目。
答案 0 :(得分:2)
我临时修复了将build.gradle文件中的jcenter()移至参数底部的问题(请参见Android gradle Failed to resolve: play-services-basement) 例如我改变了这个:
allprojects {
repositories {
jcenter()
maven {
url "https://maven.google.com"
}
}
对此:
allprojects {
repositories {
maven {
url "https://maven.google.com"
}
jcenter()
}
在第一行之前-因此无法找到地下室文件。
答案 1 :(得分:0)
您的Android Cordova平台是哪个版本?我在Cordova 8.1.2上遇到了同样的错误,但是将Android平台从7.0.0更新到7.1.1(撰写本文时为最新)之后,我能够成功构建。
cordova platform list
cordova platform remove android
cordova platform update android
cordova platform add android