Tutorial Build Failed


#1

I am brand new here and just wanted to start with the tutorial. I followed it and here was the results:

c:\cordova\myApp>ionic -v
2.2.1
c:\cordova\myApp>cordova -v
6.5.0

c:\cordova>ionic start MyIonic2Project tutorial --v2
Creating an Ionic 2.x app in c:\cordova\MyIonic2Project based on the tutorial template.
Downloading: https://github.com/driftyco/ionic2-app-base/archive/master.zip
Downloading: https://github.com/driftyco/ionic2-starter-tutorial/archive/master.
zip
Installing npm packages (may take a minute or two)…

? ♫ ? ♫ Your Ionic app is ready to go! ? ♫ ? ♫

Some helpful tips:

Run your app in the browser (great for initial development):
ionic serve

Run on a device or simulator:
ionic run ios[android,browser]

Share your app with testers, and test on device easily with the Ionic View compa
nion app:
http://view.ionic.io

c:\cordova\MyIonic2Project>cordova platform add android
Adding android project…
Creating Cordova project for the Android platform:
Path: platforms\android
Package: com.ionicframework.myionic2project595383
Name: MyIonic2Project
Activity: MainActivity
Android target: android-25
Subproject Path: CordovaLib
Android project created with cordova-android@6.1.2
Installing “cordova-plugin-console” for android
Installing “cordova-plugin-device” for android
Installing “cordova-plugin-splashscreen” for android
Installing “cordova-plugin-statusbar” for android
Installing “cordova-plugin-whitelist” for android

           This plugin is only applicable for versions of cordova-android gr

eater than 4.0. If you have a previous platform version, you do not need this
plugin since the whitelist will be built in.

Installing “ionic-plugin-keyboard” for android

c:\cordova\MyIonic2Project>ionic run android

ionic-hello-world@ ionic:build c:\cordova\MyIonic2Project
ionic-app-scripts build

[10:11:33] ionic-app-scripts 1.0.0
[10:11:33] build dev started …
[10:11:33] clean started …
[10:11:33] clean finished in 10 ms
[10:11:33] copy started …
[10:11:33] transpile started …
[10:11:36] transpile finished in 3.84 s
[10:11:36] webpack started …
[10:11:37] copy finished in 4.18 s
[10:11:45] webpack finished in 8.85 s
[10:11:45] sass started …
[10:11:46] sass finished in 1.01 s
[10:11:46] build dev finished in 13.74 s
ANDROID_HOME=C:\Users\ashworta\AppData\Local\Android\sdk
JAVA_HOME=C:\Program Files\Java\jdk1.8.0_112

Subproject Path: CordovaLib

Starting a new Gradle Daemon for this build (subsequent builds will be faster).

FAILURE: Build failed with an exception.

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

Could not resolve all dependencies for configuration ‘:classpath’.
Could not resolve com.android.tools.build:gradle:2.2.1.
Required by:
:android:unspecified
Could not resolve com.android.tools.build:gradle:2.2.1.
Could not get resource ‘https://jcenter.bintray.com/com/android/tools
/build/gradle/2.2.1/gradle-2.2.1.pom’.
Could not GET ‘https://jcenter.bintray.com/com/android/tools/build
/gradle/2.2.1/gradle-2.2.1.pom’.
sun.security.validator.ValidatorException: PKIX path building f
ailed: sun.security.provider.certpath.SunCertPathBuilderException: unable to fin
d valid certification path to requested target

  • 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: 37.257 secs

So this tutorial project runs in browser but not on Android. Any help is appreciated.

Tom


#2

Still haven’t figured out a solution. I loaded Android SDK back to 19 using AVD. Seems to be some download issue, anyone have anything that may help me get pointed in the right direction.


#3

Did you “Run with --stacktrace option to get the stack trace. Run with --info or --debug
option to get more log output.” like it says in the error message?


#4

Yes I ran with --stacktrace --info and -debug. That only gives more info on the steps that are completed, but the area of the failure it is the same. Here is area of failure with --debug on:

Subproject Path: CordovaLib

FAILURE: Build failed with an exception.

  • 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: 6.1 secs

Error: cmd: Command failed with exit code 1 Error output:
FAILURE: Build failed with an exception.

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

#5

Are you by any chance sitting behind one of those nasty firewalls that does MITM on TLS connections?


#6

Not sure, I am on a computer at work, so I assume it is firewalled. How do you build in that case?


#7

Probably the best solution would be to get the cert for the bogus CA that your employer’s firewall is using and import it using keytool into your machine’s set of trusted certificates. If that seems daunting, perhaps some other ideas might be found using this SO thread as a jumping-off point.