Ionic 3.0.1: build error in android


#1

Recently I installed android sdk from scratch using the command line tools.

My $PATH variable is updated in the ~/.bash_profile.
Ionic and Cordova version is updated too.
I installed the following packages using sdkmanager:

  • tools
  • platforms;android-25
  • build tools
  • google play services
  • google repository
  • platform tools

Directory structure

Upon building the android project, I’m getting the following error:

Error:
/Users/manugupta/Desktop/ionic-3/InvoicePhone/platforms/android/gradlew:
Command failed with exit code 1 Error output: FAILURE: Build failed
with an exception.

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

Failed to find target with hash string ‘android-25’ in: /Users/manugupta/Desktop/android_sdk

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

I have tried this solution but still getting the same error.

This is the ionic info:

Cordova CLI: 6.5.0
Ionic Framework Version: 3.0.1
Ionic CLI Version: 2.2.2
Ionic App Lib Version: 2.2.1
Ionic App Scripts Version: 1.3.0
ios-deploy version: 1.9.1 
ios-sim version: 5.0.13 
OS: macOS Sierra
Node Version: v6.10.2
Xcode version: Xcode 8.3.2 Build version 8E2002

#2

try
ionic cordova platform update android@6.2.3


#3

Thanks @dredondo. I updated the platform and still getting the same error


#4

Error message is quite clear, the android-25 thingie is missing or it thinks it’s missing.


#5

There were some missing dependencies using the command line tool sdkmanager.

So, instead I downloaded Android Studio IDE and installed the android sdk again (by configuring through Android Studio).

This resolved the error.