Update:
I followed the instructions given by benka and MBillau and then I got the Android project generated and built successfully!! So happy about it!
Now I am stuck at emulating the project on the Android emulator. Here is the error message I got when running the emulate command:
F:\Workplace\Cordova3.3.1>cordova emulate android
Generating config.xml from defaults for platform "android"
Preparing android project
Running on emulator for platform "android" via command "cmd" /c F:\Workplace\Cordova3.3.1\platforms\android\cordova\run --emulator
Error: An error occurred while emulating/deploying the android project.
events.js:72
throw er; // Unhandled 'error' event
^
Error: spawn ENOENT
at errnoException (child_process.js:980:11)
at Process.ChildProcess._handle.onexit (child_process.js:771:34)
at ChildProcess.<anonymous> (C:\Users\franv_000\AppData\Roaming\npm\node_modules\cordova\src\emulate.js:67:22)
at ChildProcess.EventEmitter.emit (events.js:98:17)
at maybeClose (child_process.js:735:16)
at Socket.<anonymous> (child_process.js:948:11)
at Socket.EventEmitter.emit (events.js:95:17)
at Pipe.close (net.js:466:12)
I actually got another error when building the Android project, but the error message for that one was clear and descriptive, so I fixed that easily. But this error message makes e confusing and have no idea where to go in order to find the solution.
Your help and time will be appreciated!
Firstly, I'd like to appreciate PhoneGap/Cordova which provides us its fantastic abilities.
Now, I have finished my development on WP8 platform with Cordova and I have set up the environment for Android development(installed Java, Ant, Android Development Tool as well as Eclipse, emulator and created the virtual Android phone)
What I also did was using CLI to add the Android platform, so I got a folder: Android under platform folder.
When I opened that folder, I was expecting to see the similar folder structure as what I've seen under wp8 folder, but it's quite different. To be honest, I don't even know to which folder I should copy my index.html. And I have checked the documentation of Cordova/PhoneGap. but found nothing. Actually, a set of guidelines about how to convert a mobile app from A platform to B platform should be put in a very obvious place on that website(After all, the main purpose of using PhoneGap/Cordova is to code once and then generate apps on different mobile platforms easily)
I am grateful if someone can help me out about this question and give me the clear guidelines about how to do it.
Thank you in advance.
Update 2: Error log when running cordova emulate -d android
F:\Workplace\Cordova3.3.1>cordova emulate -d android
cordova library for "android" already exists. No need to download. Continuing.
Generating config.xml from defaults for platform "android"
Calling plugman.prepare for platform "android"
Preparing android project
Processing configuration changes for plugins.
Iterating over installed plugins: [ 'org.apache.cordova.contacts',
'org.apache.cordova.device',
'org.apache.cordova.device-motion',
'org.apache.cordova.device-orientation',
'org.apache.cordova.dialogs',
'org.apache.cordova.geolocation',
'org.apache.cordova.network-information',
'org.apache.cordova.splashscreen',
'org.apache.cordova.vibration' ]
Writing out cordova_plugins.js...
Ensuring plugin "org.apache.cordova.contacts" is installed correctly...
Plugin "org.apache.cordova.contacts" is good to go.
Ensuring plugin "org.apache.cordova.device" is installed correctly...
Plugin "org.apache.cordova.device" is good to go.
Ensuring plugin "org.apache.cordova.device-motion" is installed correctly...
Plugin "org.apache.cordova.device-motion" is good to go.
Ensuring plugin "org.apache.cordova.device-orientation" is installed correctly...
Plugin "org.apache.cordova.device-orientation" is good to go.
Ensuring plugin "org.apache.cordova.dialogs" is installed correctly...
Plugin "org.apache.cordova.dialogs" is good to go.
Ensuring plugin "org.apache.cordova.geolocation" is installed correctly...
Plugin "org.apache.cordova.geolocation" is good to go.
Ensuring plugin "org.apache.cordova.network-information" is installed correctly...
Plugin "org.apache.cordova.network-information" is good to go.
Ensuring plugin "org.apache.cordova.splashscreen" is installed correctly...
Plugin "org.apache.cordova.splashscreen" is good to go.
Ensuring plugin "org.apache.cordova.vibration" is installed correctly...
Plugin "org.apache.cordova.vibration" is good to go.
Wrote out Android application name to "MCBTimetable"
Wrote out Android package name to "io.cordova.MCBTimetable"
Running on emulator for platform "android" via command "cmd" /c F:\Workplace\Cordova3.3.1\platforms\android\cordova\run --emulator
exec: ant clean -f "F:\Workplace\Cordova3.3.1\platforms\android\build.xml"
[ 'ant clean -f "F:\\Workplace\\Cordova3.3.1\\platforms\\android\\build.xml"',
null,
'Buildfile: F:\\Workplace\\Cordova3.3.1\\platforms\\android\\build.xml\r\n\r\n-check-env:\r\n [checkenv] Android SDK Tools Revision 22.3.0\r\n [checkenv] Inst
alled at D:\\Installation packages\\Java\\adt-bundle-windows-x86_64-20131030\\adt-bundle-windows-x86_64-20131030\\sdk\r\n\r\n-setup:\r\n [echo] Project Name
: MCBTimetable\r\n [gettype] Project Type: Application\r\n\r\n-pre-clean:\r\n\r\nclean:\r\n [delete] Deleting directory F:\\Workplace\\Cordova3.3.1\\platform
s\\android\\bin\r\n [delete] Deleting directory F:\\Workplace\\Cordova3.3.1\\platforms\\android\\gen\r\n[getlibpath] Library dependencies:\r\n[getlibpath] \r\
n[getlibpath] ------------------\r\n[getlibpath] Ordered libraries:\r\n\r\nnodeps:\r\n\r\n-check-env:\r\n [checkenv] Android SDK Tools Revision 22.3.0\r\n [chec
kenv] Installed at D:\\Installation packages\\Java\\adt-bundle-windows-x86_64-20131030\\adt-bundle-windows-x86_64-20131030\\sdk\r\n\r\n-setup:\r\n [echo] Pr
oject Name: CordovaLib\r\n [gettype] Project Type: Android Library\r\n\r\n-pre-clean:\r\n\r\nclean:\r\n [delete] Deleting directory F:\\Workplace\\Cordova3.3
.1\\platforms\\android\\CordovaLib\\bin\r\n [delete] Deleting directory F:\\Workplace\\Cordova3.3.1\\platforms\\android\\CordovaLib\\gen\r\n\r\nBUILD SUCCESSF
UL\r\nTotal time: 1 second\r\n',
'' ]
exec: ant debug -f "F:\Workplace\Cordova3.3.1\platforms\android\build.xml"
[ 'ant debug -f "F:\\Workplace\\Cordova3.3.1\\platforms\\android\\build.xml"',
null,
'Buildfile: F:\\Workplace\\Cordova3.3.1\\platforms\\android\\build.xml\r\n\r\n-set-mode-check:\r\n\r\n-set-debug-files:\r\n\r\n-check-env:\r\n [checkenv] Andr
oid SDK Tools Revision 22.3.0\r\n [checkenv] Installed at D:\\Installation packages\\Java\\adt-bundle-windows-x86_64-20131030\\adt-bundle-windows-x86_64-2013103
0\\sdk\r\n\r\n-setup:\r\n [echo] Project Name: MCBTimetable\r\n [gettype] Project Type: Application\r\n\r\n-set-debug-mode:\r\n\r\n-debug-obfuscation-check
:\r\n\r\n-pre-build:\r\n\r\n-build-setup:\r\n[getbuildtools] Using latest Build Tools: 19.0.0\r\n [echo] Resolving Build Target for MCBTimetable...\r\n[gett
arget] Project Target: Android 4.4.2\r\n[gettarget] API level: 19\r\n [echo] ----------\r\n [echo] Creating output directories if needed...\r\n
[mkdir] Created dir: F:\\Workplace\\Cordova3.3.1\\platforms\\android\\bin\r\n [mkdir] Created dir: F:\\Workplace\\Cordova3.3.1\\platforms\\android\\bin\\
res\r\n [mkdir] Created dir: F:\\Workplace\\Cordova3.3.1\\platforms\\android\\bin\\rsObj\r\n [mkdir] Created dir: F:\\Workplace\\Cordova3.3.1\\platforms\\
android\\bin\\rsLibs\r\n [mkdir] Created dir: F:\\Workplace\\Cordova3.3.1\\platforms\\android\\gen\r\n [mkdir] Created dir: F:\\Workplace\\Cordova3.3.1\\p
latforms\\android\\bin\\classes\r\n [mkdir] Created dir: F:\\Workplace\\Cordova3.3.1\\platforms\\android\\bin\\dexedLibs\r\n [echo] ----------\r\n [e
cho] Resolving Dependencies for MCBTimetable...\r\n[dependency] Library dependencies:\r\n[dependency] \r\n[dependency] ------------------\r\n[dependency] Ordere
d libraries:\r\n[dependency] \r\n[dependency] ------------------\r\n [echo] ----------\r\n [echo] Building Libraries with \'debug\'...\r\n\r\nnodeps:\r\
n\r\n-set-mode-check:\r\n\r\n-set-debug-files:\r\n\r\n-check-env:\r\n [checkenv] Android SDK Tools Revision 22.3.0\r\n [checkenv] Installed at D:\\Installation
packages\\Java\\adt-bundle-windows-x86_64-20131030\\adt-bundle-windows-x86_64-20131030\\sdk\r\n\r\n-setup:\r\n [echo] Project Name: CordovaLib\r\n [gettype
] Project Type: Android Library\r\n\r\n-set-debug-mode:\r\n\r\n-debug-obfuscation-check:\r\n\r\n-pre-build:\r\n\r\n-build-setup:\r\n[getbuildtools] Using latest
Build Tools: 19.0.0\r\n [echo] Resolving Build Target for CordovaLib...\r\n[gettarget] Project Target: Android 4.4.2\r\n[gettarget] API level: 19\
r\n [echo] ----------\r\n [echo] Creating output directories if needed...\r\n [mkdir] Created dir: F:\\Workplace\\Cordova3.3.1\\platforms\\android\\C
ordovaLib\\bin\r\n [mkdir] Created dir: F:\\Workplace\\Cordova3.3.1\\platforms\\android\\CordovaLib\\bin\\res\r\n [mkdir] Created dir: F:\\Workplace\\Cord
ova3.3.1\\platforms\\android\\CordovaLib\\bin\\rsObj\r\n [mkdir] Created dir: F:\\Workplace\\Cordova3.3.1\\platforms\\android\\CordovaLib\\bin\\rsLibs\r\n
[mkdir] Created dir: F:\\Workplace\\Cordova3.3.1\\platforms\\android\\CordovaLib\\gen\r\n [mkdir] Created dir: F:\\Workplace\\Cordova3.3.1\\platforms\\andro
id\\CordovaLib\\bin\\classes\r\n [mkdir] Created dir: F:\\Workplace\\Cordova3.3.1\\platforms\\android\\CordovaLib\\bin\\dexedLibs\r\n [echo] ----------\r
\n [echo] Resolving Dependencies for CordovaLib...\r\n[dependency] Library dependencies:\r\n[dependency] No Libraries\r\n[dependency] \r\n[dependency] -----
-------------\r\n\r\n-code-gen:\r\n[mergemanifest] Merging AndroidManifest files into one.\r\n[mergemanifest] Manifest merger disabled. Using project manifest o
nly.\r\n [echo] Handling aidl files...\r\n [aidl] No AIDL files to compile.\r\n [echo] ----------\r\n [echo] Handling RenderScript files...\r\n
[echo] ----------\r\n [echo] Handling Resources...\r\n [aapt] Generating resource IDs...\r\n [echo] ----------\r\n [echo] Handling BuildConf
ig class...\r\n[buildconfig] Generating BuildConfig class.\r\n\r\n-pre-compile:\r\n\r\n-compile:\r\n [javac] Compiling 73 source files to F:\\Workplace\\Cord
ova3.3.1\\platforms\\android\\CordovaLib\\bin\\classes\r\n [javac] Note: Some input files use or override a deprecated API.\r\n [javac] Note: Recompile wi
th -Xlint:deprecation for details.\r\n [echo] Creating library output jar file...\r\n [jar] Building jar: F:\\Workplace\\Cordova3.3.1\\platforms\\andro
id\\CordovaLib\\bin\\classes.jar\r\n\r\n-post-compile:\r\n\r\n-obfuscate:\r\n\r\n-dex:\r\n [echo] Library project: do not convert bytecode...\r\n\r\n-crunch
:\r\n [crunch] Crunching PNG Files in source dir: F:\\Workplace\\Cordova3.3.1\\platforms\\android\\CordovaLib\\res\r\n [crunch] To destination dir: F:\\Work
place\\Cordova3.3.1\\platforms\\android\\CordovaLib\\bin\\res\r\n [crunch] Crunched 0 PNG files to update cache\r\n\r\n-package-resources:\r\n [echo] Libr
ary project: do not package resources...\r\n\r\n-package:\r\n [echo] Library project: do not package apk...\r\n\r\n-post-package:\r\n\r\n-do-debug:\r\n
[echo] Library project: do not create apk...\r\n[propertyfile] Creating new property file: F:\\Workplace\\Cordova3.3.1\\platforms\\android\\CordovaLib\\bin\\bui
ld.prop\r\n[propertyfile] Updating property file: F:\\Workplace\\Cordova3.3.1\\platforms\\android\\CordovaLib\\bin\\build.prop\r\n[propertyfile] Updating proper
ty file: F:\\Workplace\\Cordova3.3.1\\platforms\\android\\CordovaLib\\bin\\build.prop\r\n[propertyfile] Updating property file: F:\\Workplace\\Cordova3.3.1\\pla
tforms\\android\\CordovaLib\\bin\\build.prop\r\n\r\n-post-build:\r\n\r\ndebug:\r\n\r\n-code-gen:\r\n[mergemanifest] Merging AndroidManifest files into one.\r\n[
mergemanifest] Manifest merger disabled. Using project manifest only.\r\n [echo] Handling aidl files...\r\n [aidl] No AIDL files to compile.\r\n [ec
ho] ----------\r\n [echo] Handling RenderScript files...\r\n [echo] ----------\r\n [echo] Handling Resources...\r\n [aapt] Generating resource I
Ds...\r\n [echo] ----------\r\n [echo] Handling BuildConfig class...\r\n[buildconfig] Generating BuildConfig class.\r\n\r\n-pre-compile:\r\n\r\n-compile
:\r\n [javac] Compiling 17 source files to F:\\Workplace\\Cordova3.3.1\\platforms\\android\\bin\\classes\r\n\r\n-post-compile:\r\n\r\n-obfuscate:\r\n\r\n-dex
:\r\n [dex] input: F:\\Workplace\\Cordova3.3.1\\platforms\\android\\bin\\classes\r\n [dex] input: F:\\Workplace\\Cordova3.3.1\\platforms\\android\\Cor
dovaLib\\bin\\classes.jar\r\n [dex] Pre-Dexing F:\\Workplace\\Cordova3.3.1\\platforms\\android\\CordovaLib\\bin\\classes.jar -> classes-a9bfeb13801703244de
81d2eb7af0f8a.jar\r\n [dex] Converting compiled files and external libraries into F:\\Workplace\\Cordova3.3.1\\platforms\\android\\bin\\classes.dex...\r\n
[dx] Merged dex A (46 defs/73.9KiB) with dex B (174 defs/271.6KiB). Result is 220 defs/420.7KiB. Took 0.2s\r\n\r\n-crunch:\r\n [crunch] Crunching PNG Fi
les in source dir: F:\\Workplace\\Cordova3.3.1\\platforms\\android\\res\r\n [crunch] To destination dir: F:\\Workplace\\Cordova3.3.1\\platforms\\android\\bin\
\res\r\n [crunch] Processing image to cache: F:\\Workplace\\Cordova3.3.1\\platforms\\android\\res\\drawable-hdpi\\icon.png => F:\\Workplace\\Cordova3.3.1\\pla
tforms\\android\\bin\\res\\drawable-hdpi\\icon.png\r\n [crunch] (processed image to cache entry F:\\Workplace\\Cordova3.3.1\\platforms\\android\\bin\\res\\d
rawable-hdpi\\icon.png: 67% size of source)\r\n [crunch] Processing image to cache: F:\\Workplace\\Cordova3.3.1\\platforms\\android\\res\\drawable-ldpi\\icon.
png => F:\\Workplace\\Cordova3.3.1\\platforms\\android\\bin\\res\\drawable-ldpi\\icon.png\r\n [crunch] (processed image to cache entry F:\\Workplace\\Cordov
a3.3.1\\platforms\\android\\bin\\res\\drawable-ldpi\\icon.png: 0% size of source)\r\n [crunch] Processing image to cache: F:\\Workplace\\Cordova3.3.1\\platfor
ms\\android\\res\\drawable-mdpi\\icon.png => F:\\Workplace\\Cordova3.3.1\\platforms\\android\\bin\\res\\drawable-mdpi\\icon.png\r\n [crunch] (processed imag
e to cache entry F:\\Workplace\\Cordova3.3.1\\platforms\\android\\bin\\res\\drawable-mdpi\\icon.png: 0% size of source)\r\n [crunch] Processing image to cache
: F:\\Workplace\\Cordova3.3.1\\platforms\\android\\res\\drawable-xhdpi\\icon.png => F:\\Workplace\\Cordova3.3.1\\platforms\\android\\bin\\res\\drawable-xhdpi\\i
con.png\r\n [crunch] (processed image to cache entry F:\\Workplace\\Cordova3.3.1\\platforms\\android\\bin\\res\\drawable-xhdpi\\icon.png: 53% size of source
)\r\n [crunch] Processing image to cache: F:\\Workplace\\Cordova3.3.1\\platforms\\android\\res\\drawable\\icon.png => F:\\Workplace\\Cordova3.3.1\\platforms\\
android\\bin\\res\\drawable\\icon.png\r\n [crunch] (processed image to cache entry F:\\Workplace\\Cordova3.3.1\\platforms\\android\\bin\\res\\drawable\\icon
.png: 53% size of source)\r\n [crunch] Crunched 5 PNG files to update cache\r\n\r\n-package-resources:\r\n [aapt] Creating full resource package...\r\n
[aapt] Warning: AndroidManifest.xml already defines debuggable (in http://schemas.android.com/apk/res/android); using existing value in manifest.\r\n\r\n-pack
age:\r\n[apkbuilder] Current build type is different than previous build: forced apkbuilder run.\r\n[apkbuilder] Creating MCBTimetable-debug-unaligned.apk and s
igning it with a debug key...\r\n\r\n-post-package:\r\n\r\n-do-debug:\r\n [zipalign] Running zip align on final apk...\r\n [echo] Debug Package: F:\\Workpla
ce\\Cordova3.3.1\\platforms\\android\\bin\\MCBTimetable-debug.apk\r\n[propertyfile] Creating new property file: F:\\Workplace\\Cordova3.3.1\\platforms\\android\
\bin\\build.prop\r\n[propertyfile] Updating property file: F:\\Workplace\\Cordova3.3.1\\platforms\\android\\bin\\build.prop\r\n[propertyfile] Updating property
file: F:\\Workplace\\Cordova3.3.1\\platforms\\android\\bin\\build.prop\r\n[propertyfile] Updating property file: F:\\Workplace\\Cordova3.3.1\\platforms\\android
\\bin\\build.prop\r\n\r\n-post-build:\r\n\r\ndebug:\r\n\r\nBUILD SUCCESSFUL\r\nTotal time: 15 seconds\r\n',
'' ]
exec: adb devices
[ 'adb devices', null, 'List of devices attached \r\n\r\n', '' ]
exec: adb devices
[ 'adb devices', null, 'List of devices attached \r\n\r\n', '' ]
exec: android list avds
[ 'android list avds',
null,
'Available Android Virtual Devices:\n Name: MyVA\n Path: C:\\Users\\franv_000\\.android\\avd\\MyVA.avd\n Target: Android 4.4.2 (API level 19)\n ABI
: armeabi-v7a\n Skin: 768x1280\n',
'' ]
exec: android list avds
[ 'android list avds',
null,
'Available Android Virtual Devices:\n Name: MyVA\n Path: C:\\Users\\franv_000\\.android\\avd\\MyVA.avd\n Target: Android 4.4.2 (API level 19)\n ABI
: armeabi-v7a\n Skin: 768x1280\n',
'' ]
events.js:72
throw er; // Unhandled 'error' event
^
Error: spawn ENOENT
at errnoException (child_process.js:980:11)
at Process.ChildProcess._handle.onexit (child_process.js:771:34)
child_process.spawn(cmd,[/c, F:\Workplace\Cordova3.3.1\platforms\android\cordova\run, --emulator]) = 8
Error: An error occurred while emulating/deploying the android project.
events.js:72
throw er; // Unhandled 'error' event
^
Error: spawn ENOENT
at errnoException (child_process.js:980:11)
at Process.ChildProcess._handle.onexit (child_process.js:771:34)
at ChildProcess.<anonymous> (C:\Users\franv_000\AppData\Roaming\npm\node_modules\cordova\src\emulate.js:67:22)
at ChildProcess.EventEmitter.emit (events.js:98:17)
at maybeClose (child_process.js:735:16)
at Socket.<anonymous> (child_process.js:948:11)
at Socket.EventEmitter.emit (events.js:95:17)
at Pipe.close (net.js:466:12)