Ionic Cordova Build Failure


#1

Unable to build using “ionic cordova build android” - been struggling with this for several hours and cannot seem to get around it

“ANDROID_HOME=C:\Users\dbogdan\AppData\Local\Android\sdk
JAVA_HOME=C:\Program Files\Java\jdk1.8.0_121
The system cannot find the path specified.
Error: cmd: Command failed with exit code 1”

Both of those paths work with dir “X”

ionic info

global packages:

@ionic/cli-utils : 1.4.0
Cordova CLI      : 7.0.1
Ionic CLI        : 3.4.0

local packages:

@ionic/app-scripts              : 1.3.7
@ionic/cli-plugin-cordova       : 1.4.0
@ionic/cli-plugin-ionic-angular : 1.3.1
Cordova Platforms               : android 6.2.2 browser 4.1.0
Ionic Framework                 : ionic-angular 3.2.1

System:

Node       : v7.5.0
OS         : Windows 10
Xcode      : not installed
ios-deploy : not installed
ios-sim    : not installed
npm        : 4.1.2

package.json:

"cordova": {
    "plugins": {
        "cordova-plugin-geolocation": {},
        "cordova-plugin-console": {},
        "cordova-plugin-device": {},
        "cordova-plugin-splashscreen": {},
        "cordova-plugin-statusbar": {},
        "cordova-plugin-whitelist": {},
        "ionic-plugin-keyboard": {},
        "cordova-plugin-mauron85-background-geolocation": {
            "ACCOUNT_TYPE": "$PACKAGE_NAME.account",
            "CONTENT_AUTHORITY": "$PACKAGE_NAME"
        },
        "cordova-plugin-compat": {},
        "cordova-plugin-camera": {},
        "cordova-plugin-facebook4": {
            "APP_ID": "X",
            "APP_NAME": "X"
        }
    },
    "platforms": [
        "android",
        "browser"
    ]
}

#2

Does C:\Program Files\Java\jdk1.8.0_121 and C:\Users\dbogdan\AppData\Local\Android\sdk exist?
Run cordova requirements.


#3

Both exist, the dir listing works and I can navigate to them

C:\Users\dbogdan\X>cordova requirements

Requirements check results for android:
Java JDK: installed 1.8.0
Android SDK: installed true
Android target: not installed
cmd: Command failed with exit code 1
Gradle: installed C:\Program Files\Android\Android Studio\gradle\gradle-3.2\bin\gradle

Requirements check results for browser:
Check failed for browser due to Failed to check requirements for browser platform. check_reqs module is missing for platform. Skipping it…

Requirements check results for ios:
Apple OS X: not installed
Cordova tooling for iOS requires Apple OS X
Error: Some of requirements check failed


#4

Open Android Studio, go to SDK Manager, install an Android Target. Maybe restart you computer, try again.