Skip to content Skip to sidebar Skip to footer

Ionic2 - Android Build Failed

I was trying to build an Ionic2 app with Android platform on my Win 7 (32 bt) system. I ran the ionic build android command in the CLI and the following error occurred : ...ionic

Solution 1:

Found the solution after a hour long R&D.

Basically as per 'https://cordova.apache.org/docs/en/latest/guide/platforms/android/' - As of cordova-android@4.0.0, Cordova for Android projects are built using Gradle. Earlier it was built using Apache Ant.

Now Gradle looks for latest Android SDK. When I removed the android platform and added again with ionic platform add android command - the CLI listed that the latest Android SDK ( in my case it was SDK 24 ) was not installed.

I installed the required SDK version using Android SDK Manager and subsequent add of Android Platform along with the cordova plugin smoothly installed without any error.

The CLI printed the following -

..ionic plugin add onesignal-cordova-plugin

Fetching plugin "onesignal-cordova-plugin" via npm

Installing "onesignal-cordova-plugin"for android

ANDROID_HOME=C:\Program Files (x86)\Android\android-sdk

JAVA_HOME=C:\Program Files\Java\jdk1.8.0_121

Subproject Path: CordovaLib

Incremental java compilation is an incubating feature.
:clean
:CordovaLib:clean

BUILD SUCCESSFUL

Total time: 1.611 secs

Subproject Path: CordovaLib

Solution 2:

Try using cordova platform add https://github.com/apache/cordova-android

Ive had to start using this command ever since updating Ionic.

Post a Comment for "Ionic2 - Android Build Failed"