Dienstag, 20. Mai 2014

Cordova Apache

Cordova Apache is a Toooools from Apache, with that we can create/convert Web Application, written with HTML, CSS, JavaScript to a Mobile App.
So the programmer has access to the sources of a mobile like GPS,Camera, ...

As a starter, starting with and installing the cordova was the hardest part so far.
For running just a Hello Welt program, the programmer needs to do/install following tools:
( This list is more Android oriented )

- Node.js
- Java JDK 1.5 or greater
- Apache Ant 1.8.0 or greater
- Android SDK [http://developer.android.com](http://developer.android.com)
- adb driver for your device

* After downloading and unzipping cordova, a readme file for every OS is to find. In this file we can find the requirements for an OS.

Some steps for installing tools:
1 - Installing cordova under node.js
  - open node.js cmd,
  - npm install cordova

2 - After installing java, ant, android sdk, the very important step is adding path in environment variables:
     in user variable:
       new Variable: ANT_HOME
       path: your ant path ( mine: C:\Program Files\Ant )
      
       new Variable: JAVA_HOME
       path: your java path ( mine: C:\Program Files\Java\jdk1.7.0_25 )
     
      and in path:
       C:\Program Files\Java\jdk1.7.0_25\bin;D:\Software\Android\adt-bundle-windows-x86_64-       20140321\sdk\platform-tools

   in system variables: ( add your path )
C:\Program Files\nodejs\;C:\Program Files\Ant\bin;C:\Program Files\Java\jdk1.7.0_25\bin;D:\Software\Android\adt-bundle-windows-x86_64-20140321\sdk\tools


3 - If your eclips doesn't work properly, maybe you should add the sdk path in eclips as follow:
eclips -> window -> preferences -> Android -> SDK location

mine is as follow:
D:\Software\Android\adt-bundle-windows-x86_64-20140321\sdk

4 - Now you have your cordova installed ( I hope ) here are some links an commands:
  - You can use the link underneath to build a "Hello World" Project

5 - Some cordova commands:
    -  Creating a cordova project:   cordova create hello com.example.hello "HelloWorld"   
    -  cd hello
    - Making project ready for your OS ( here Android ):   cordova platform add android
    - Building project:  cordova build  

6 - Testing:
6- 1  - Eclips: New -> Project -> Android -> From existing project   ( load the project)
               - Select the project and Run as Android Application
6 - 2 - cordova run android
         For running this command you need 'adb devices' to get running. If you can't see any adb device, you need to install your device driver.


* Last Hint:
   In every step, if you see an error, stay cool and don't forget asking uncle google!


















Keine Kommentare:

Kommentar veröffentlichen