0

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

This is the output of cordova requirements. Everything except Android target is installed.

Android target: not installed Android SDK not found. Make sure that it is installed. If it is not at the default location, set the ANDROID_HOME environment variable.

However, I have installed android-25 using sdkmanager "sources;android-25.Also, ANDROID_HOME is also set.

This is my ~/.bash_profile:

export ANDROID_HOME=/Users/manugupta/Desktop/android_sdk
export PATH=/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
export PATH=${PATH}:$ANDROID_HOME/bin/:$ANDROID_HOME/platform-tools:$ANDROID_HOME/build-tools/25.0.2/:$ANDROID_HOME/tools:$ANDROID_HOME/sources

This is the output of echo $ANDROID_HOME: /Users/manugupta/Desktop/android_sdk

This is the output of cordova requirements:

Requirements check results for android:
Java JDK: installed 1.8.0
Android SDK: installed true
Android target: not installed 
Android SDK not found. Make sure that it is installed. If it is not at the default location, set the ANDROID_HOME environment variable.
Gradle: installed 

Requirements check results for ios:
Apple OS X: installed darwin
Xcode: installed 8.3.2
ios-deploy: installed 1.9.1
Error: Some of requirements check failed
Community
  • 1
  • 1
Manu Gupta
  • 351
  • 1
  • 5
  • 18

1 Answers1

0

There were some missing dependencies using sdkmanager.

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

Manu Gupta
  • 351
  • 1
  • 5
  • 18