Ionic android build Could not resolve all files for configuration ':app:debugCompileClasspath'

I getting this error when I run android ionic Cordova build android


FAILURE: Build failed with an exception.


* What went wrong:
Could not resolve all files for configuration ':app:debugCompileClasspath'.
> Could not find play-services-basement.aar (com.google.android.gms:play-services-basement:15.0.1).
  Searched in the following locations:
      https://jcenter.bintray.com/com/google/android/gms/play-services-basement/15.0.1/play-services-basement-15.0.1.aar

* Try:
Run with --stacktrace option to get the stack trace. Run with
--info or --debug
 option to get more log output.

* Get more help at https://help.gradle.org

BUILD FAILED in 4s
11 actionable tasks: 11 executed
(node:11780) UnhandledPromiseRejectionWarning: Error: /Users/anspireagency/Desktop/ahmed f/Doctory/platforms/android/gradlew: Command failed with exit code 1 Error output:
FAILURE: Build failed with an exception.

* What went wrong:
Could not resolve all files for configuration ':app:debugCompileClasspath'.
> Could not find play-services-basement.aar (com.google.android.gms:play-services-basement:15.0.1).
  Searched in the following locations:
      https://jcenter.bintray.com/com/google/android/gms/play-services-basement/15.0.1/play-services-basement-15.0.1.aar

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

* Get more help at https://help.gradle.org

BUILD FAILED in 4s
    at ChildProcess.whenDone (/Users/anspireagency/Desktop/ahmed f/Doctory/platforms/android/cordova/node_modules/cordova-common/src/superspawn.js:169:23)
    at emitTwo (events.js:126:13)
    at ChildProcess.emit (events.js:214:7)
    at maybeClose (internal/child_process.js:925:16)
    at Socket.stream.socket.on (internal/child_process.js:346:11)
    at emitOne (events.js:116:13)
    at Socket.emit (events.js:211:7)
    at Pipe._handle.close [as _onclose] (net.js:557:12)
(node:11780) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:11780) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

info

cli packages: (/usr/local/lib/node_modules)

    @ionic/cli-utils  : 1.19.2
    ionic (Ionic CLI) : 3.20.0

global packages:

    cordova (Cordova CLI) : 8.0.0

local packages:

    @ionic/app-scripts : 3.1.8
    Cordova Platforms  : android 7.0.0
    Ionic Framework    : ionic-angular 3.9.2

System:

    Android SDK Tools : 26.1.1
    ios-deploy        : 1.9.2
    ios-sim           : 6.1.2
    Node              : v8.11.3
    npm               : 5.6.0
    OS                : macOS High Sierra
    Xcode             : Xcode 9.2 Build version 9C40b

Environment Variables:

    ANDROID_HOME : /Users/anspireagency/Library/Android/sdk/

Misc:

    backend : pro
1 Like

Having the same issue here

Did you update Android studio last few days ?

I actually removed the SDK for 23… then updated a Android studio but that was after the issue started.
I removed the Android to be 6.4.0 as opposed to 7 and the issues started to be clearer and I ended up using:

"cordova-android-firebase-gradle-release": "^1.0.3",
"cordova-android-play-services-gradle-release": "^1.4.4",

also to solve the issue I added “google()” into the build.gradle file in the following locations:


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

    // Switch the Android Gradle plugin version requirement depending on the
    // installed version of Gradle. This dependency is documented at
    // http://tools.android.com/tech-docs/new-build-system/version-compatibility
    // and https://issues.apache.org/jira/browse/CB-8143
    dependencies {
        classpath 'com.android.tools.build:gradle:3.0.0'
    }
}

// Allow plugins to declare Maven dependencies via build-extras.gradle.
allprojects {
    repositories {
        google()
        jcenter()
        maven {
            url "https://maven.google.com"
        }
    }
}```
1 Like

i fixed it by moving jcenter() to the bottom and i got apk file

1 Like

cordova platform add android@6.4.0 works for me. It is my magic wand. All the rest you guys mentioned just did not work. Still does not (using Ionic 4 now).

it worked perfectly for me

i fixed it by moving google() to the ‘allprojects’ area and it worked like a charm!

@BooM157, donde está ubicado el google()? favor ayudarme con esto.