Can't Take Android Build

#1

Ionic:

ionic (Ionic CLI) : 4.1.0 (/usr/local/lib/node_modules/ionic)
Ionic Framework : ionic-angular 3.7.1
@ionic/app-scripts : 3.1.11

Cordova:

cordova (Cordova CLI) : 6.4.0
Cordova Platforms : android 6.0.0, ios 4.5.5
Cordova Plugins : cordova-plugin-ionic-webview 2.0.2, (and 14 other plugins)

System:

ios-deploy : 2.0.0
NodeJS : v10.8.0 (/usr/local/bin/node)
npm : 6.3.0
OS : macOS High Sierra
Xcode : Xcode 9.4.1 Build version 9F2000

Environment:

ANDROID_HOME : not set

Error:

cordova build android
cordova-android-play-services-gradle-release: Android platform: cordova-android@6
cordova-android-play-services-gradle-release: No custom version found in config.xml - using plugin default
cordova-android-play-services-gradle-release: Android platform: cordova-android@6
cordova-android-play-services-gradle-release: No custom version found in config.xml - using plugin default
ANDROID_HOME=/Users/brt/Library/Android/sdk
JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_161.jdk/Contents/Home
Subproject Path: CordovaLib
Starting a new Gradle Daemon for this build (subsequent builds will be faster).

FAILURE: Build failed with an exception.

  • Where:
    Build file ‘/Users/brt/Documents/Developement/ionic/belafy/platforms/android/build.gradle’ line: 253

  • What went wrong:
    A problem occurred evaluating root project ‘android’.

Could not get unknown property ‘PLAY_SERVICES_VERSION’ for object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.

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

BUILD FAILED

Total time: 5.837 secs
Error: /Users/brt/Documents/Developement/ionic/belafy/platforms/android/gradlew: Command failed with exit code 1 Error output:
FAILURE: Build failed with an exception.

  • Where:
    Build file ‘/Users/brt/Documents/Developement/ionic/belafy/platforms/android/build.gradle’ line: 253

  • What went wrong:
    A problem occurred evaluating root project ‘android’.

Could not get unknown property ‘PLAY_SERVICES_VERSION’ for object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.

  • Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
    [ERROR] An error occurred while running subprocess cordova.

      cordova build android exited with exit code 1.
      
      Re-running this command with the --verbose flag may provide more information.
#2

Looks like you haven’t set Android SDK in environment.
Add android SDK in .bash_profile

Commands:
$ nano .bash_profile.

export ANDROID_HOME=/Users/Jhon/Library/Android/sdk export PATH=$PATH:$ANDROID_HOME/tools export PATH=$PATH:$ANDROID_HOME/tools/bin export PATH=$PATH/:$ANDROID_HOME/platform-tools

source .bash_profile

#3

Your Cordova tooling seems to be out of date, which might be causing all kinds of problems.
You can read about how to figure out the current Cordova versions and how to update CLI, platforms and plugins here: https://ionic.zone/cordova/update