Open main menu

CDOT Wiki β

Changes

MAP524/DPS924 Lecture 11

1,003 bytes added, 23:51, 10 August 2015
Setup
<source lang="bash">npm install -g cordova</source>
 
== Create a project ==
 
You could create an Android project as you normally do and turn it into a cordova project, but you may as well use the cordova command to do it for you. First step is to generate the project structure:
 
<source lang="bash">cordova create cordova-test ca.littlesvr.cordovatest HelloWorld</source>
 
It will create the directory cordova-test with your application code under "www". You can start working on your app at this point but there's one more thing you need to do before you can build an Android version:
 
<source lang="bash">cordova platform add android</source>
 
Now under platforms you have an android directory which has all the android-related project files, but don't bother trying to open that with Android Studio or building it directly with gradle - you'll just get a headache. Instead use the cordova command again:
 
<source lang="bash">cordova build</source>
 
Once that is done it will tell you where is the generated .apk file and you can install it using adb.