Ajith Kumar
Ajith Kumar

Reputation: 11

Not able to build ionic project using cordova, it shows Task 'cordova' not found

I am new to android, cordova and ionic. I have created a simple ionic hybrid application and trying to build to android platform and it gives the following error

"grunt cordova" from the application directory is giving "Warning: Task "cordova" not found, Use --force to continue. Aborted due to warnings.

When I tried "cordova platform add android" it is giving Error: command failed with exit code ENOENT

Please help me to get this solved.

Following is my system and software details, and also included some diagnostics

Operating System: Windows 8, 64-bit

Installable • Java: jdk1.8.0.31, 64-bit • Ant: apache-ant-1.9.4 • Android SDK: android-sdk_r24.0.2-windows, 64-bt • Cordova: 4.2.0 PATH Environment Variable • Java : C:\Program Files\Java\jdk1.8.0_31\bin • Ant: C:\Program Files\apache-ant-1.9.4\bin • Android ○ Tools: C:\Program Files\Android\tools ○ Platform-tools: C:\Program Files\Android\platform-tools ○ Build Tools: C:\Program Files\Android • npm: C:\Users\<>\AppData\Roaming\npm

HOME Environment variables • JAVA_HOME: C:\Program Files\Java\jdk1.8.0_31 • ANT_HOME: C:\Program Files\apache-ant-1.9.4 • ANDROID_HOME: C:\Program Files\Android Grunt Version - grunt-cli v0.1.13, grunt v0.4.5

Diagnostics 1) c:\IonicTut\firstProject>grunt cordova Warning: Task "cordova" not found. Use --force to continue Aborted due to warnings

2) c:\IonicTut\firstProject>cordova platform add android Error: Command failed with exit code ENOENT at ChildProcess.whenDone ...

3) Then I went to user .cordova and executed check_reqs.bat, it gave the following error, even though android sdk installed and PATH and ANDROID_HOME was set as listed earlier. Error: Please install Android target 19 . Make sure you have the latest Android tools installed as well. Run "android" from your command-line to install/update any missing SDKs or tools.]

4) As instructed in the above message I have tried executing android from the command prompt, then it gave me the following message and saying suitable java not found, I have installed Java SDK and set PATH to JDK bin and JAVA_HOME to JDK folder.

Error: No suitable Java found. In order to properly use the Android Developer Tools, you need a suitable version of Java JDK installed …

Upvotes: 1

Views: 6649

Answers (2)

NexusInk
NexusInk

Reputation: 41

Due to whitespaces throwing errors in naming conventions, it is good practice to use file names with not "gaps" between them. By changing C:\Program Files\ to C:\Progra~1\ you can correct the Environment Variables need to compile the various resources.

Upvotes: 1

TheHeff
TheHeff

Reputation: 161

What you can do instead of opening the SDK manager in CMD prompt, with the command android, is open a file explorer window and simply search for SDK Manager.exe. Once found double click to launch the .exe file from there you will need to select Android 4.4.2(API 19) and install.

SDK Manager.exe is usually located at C:\Users\[user]\AppData\Local\Android\android-sdk - Just keep in mind that the AppData directory is usually hidden so you can either type this into your address bar or you can unhide all files and folders. (Unhiding is not advised for safety as you may forget to hide again when finished the task.)

Upvotes: 0

Related Questions