Ionic3 Build-Error: Could not find play-services-a

2019-02-14 06:15发布

i have a bigger Ionic3 project running and did not do any changes since i had a successful build last time. Today, i tried to build again, getting the error:

Could not find play-services-auth-base.aar (com.google.android.gms:play-services-auth-base:15.0.1).

I can not figure out why this happens. Cordova-platform is Version 6.3.0.

Steps done so far:

  • Installed cordova-android-play-services-gradle-release, which 15.+ as version during the build

  • Installed cordova-android-support-gradle-release, which 27.+ as version during the build

  • Manipulated gradle.build within the platform, as recommended in other stackoverflow-questions.

  • Maybe updating cordova to 7.x also is an option, but i want to avoid it due to multiple cordova plugin dependencies.

Code:

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

4条回答
The star\"
2楼-- · 2019-02-14 06:40

As far as I can see, this error may also occur, when Google or anyone else marks the repository "google-cache" as "blacked-out". Then instead of getting the library you want, you'll get a json string representig that error. It seems that this is enough information for Android Studio to say "OK, found a library entry, but its not there", so the build will fail. google() or maven() should then provide a backup entry, but because jcenter() was the first repository in the list and has given a "proper answer" of the request gradle won't ask the other repos for a solution.

As @Manuel already posted, just put the google() repo before jcenter() in your projects build.gradle.

查看更多
叼着烟拽天下
3楼-- · 2019-02-14 06:43

If your app does not require any of the newer Google APIs, try specifying an older Play Services Version in your config.xml file. I got a successful build by using 11.6.2. Anything newer gave me the same build error.

查看更多
SAY GOODBYE
4楼-- · 2019-02-14 06:47

There is currently something wrong with the jcenter() repository. I guess they will fix that soon.

Anyway, for the most packages a fix could be to add the google() repository at the first position in the build.gradle file:

buildscript {
  repositories {
    google()
    jcenter()
  }
}

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

It's important that google() is listed before jcenter().

查看更多
在下西门庆
5楼-- · 2019-02-14 06:47

According to this: https://developer.android.com/topic/libraries/support-library/setup

if you're using a version of Gradle lower than 4.1, you must use

maven { url 'maven.google.com'; }

instead of

google()
查看更多
登录 后发表回答