PhoneGap on ubuntu for Android app development

I have installed PhoneGap 3.0.0 on Elementary OS Luna.

Installation Process

  1. Upgrade npm

    • npm update npm -g
    • sudo npm install n -g
      
    • sudo n stable
      
  2. Install phonegap
    sudo npm install -g phonegap
  3. Run ‘android’, select a target (e.g. “Android 4.2.2 (API 19)”), and click the “Install 8 packages” button.
  4. Download the Android sdk from http://developer.android.com/sdk/index.html
    • sudo mv ~/Downloads/adt-bundle-linux-x86_64-20130729.zip /opt/
      
    • cd /opt
      
    • sudo unzip adt-bundle-linux-x86_64-20130729.zip 
      
    • sudo chmod -R 777 /opt/adt-bundle-linux-x86_64-20130729.zip
  5. Update PATH in ~/.bashrc to include the phonegap tools:
    # Path to android sdk
    PATH=$PATH:/opt/adt-bundle-linux-x86_64-20130729/sdk/platform-tools:/opt/adt-bundle-linux-x86_64-20130729/sdk/tools
  6. Install ANTsudo apt-get -u install ant

Create an app

  1. Create app
    • phonegap create my-app
      
    • cd my-app
  2. Run the app
    • phonegap local run android

      If this didn’t work  (popping-up an error message) – we needed an emulator to be set up. In Android util, go to Tools -> Manage AVDs, use the New button to create a new AVD, then Start the AVD. First time it failed to get start kill it and run once again.

    • phonegap local build android
      phonegap install android

 

Advertisements