วันศุกร์ที่ 16 ตุลาคม พ.ศ. 2558

การติดตั้ง Cordova/PhoneGap และ Android Studio บน Windows

  1. Download JDK- Java SE Development Kit - Windows x64 - (latest edition) and Install using default options
    1. Add a system variable JAVA_HOME and point it to the directory containing the contents of the JDK (example C:\Program Files\Java\jdk1.7.0_51)
    2. Add ;%JAVA_HOME%\bin; to the Path system variable.
    3. If you have a Proxy Server, note proxy server settings and:
      1. Start --> Type Java Control Panel
      2. General Tab --> Click Network Settings...
      3. Choose the appropriate settings, "use browser settings" may work for you.
    4. Validate Java Install:
      1. From a command prompt enter the following
        java -version
      2. You should see something like :
        java version "1.7.0_51"

  2. Download Apache Ant and extract to a directory on your computer. (example C:\util\ant\)
    1. Add a system variable ANT_HOME and point it to the directory containing the contents of the ANT directory
    2. Add ;%ANT_HOME%\bin; to the Path system variable.
    3. Validate Ant Install:
      1. From a command prompt enter the following
        ant -version
      2. You should see something like :
        Apache Ant(TM) version 1.9.3 compiled on December 23 2013
      3. Troubleshooting: Unable to locate tools.jar (check to see if JAVA_HOME is set properly)
  3. Download Android Studio and Install using default settings.
    1. If you have a Proxy Server, note proxy server settings and open Android Studio:
      1. File --> Settings --> (IDE Settings Section) --> HTTP Proxy
      2. Make the appropriate selection for your environment.
    2. Add a system variable ANDROID_HOME and point it to the directory containing the android sdk that's installed with Android Studio (example: C:\Users\jdoe\AppData\Local\Android\android-studio\sdk)
    3. Add the following to your Path system variable:
      1. ;%ANDROID_HOME%\platform-tools;%ANDROID_HOME%\tools;
  4. Download Node and Install (if you already have it installed, download and install again to update it)
    1. Clear your NPM cache (this may save some headaches):
      npm cache clean
    2. If behind a firewall, configure node to speak to the firewall by issuing the following commands:
      npm config set proxy http://domain%5Cusername:password@ipaddress:port
      npm config set https-proxy http://domain%5Cusername:password@ipaddress:port
    3. Validate Node Install:
      1. From a command prompt enter the following
        node --version
      2. You should see something like :
        v0.10.26
    4. Update Node & Global Packages
      1. Update Node:
        npm update -g n
      2. Update Global Packages:
        npm update -g
  5. Install Cordova
    npm install -g cordova
  6. Install Plugman
    npm install -g plugman
    1. If behind a firewall, configure plugman to speak to the firewall by issuing the following commands:
      plugman config set proxy http://domain%5Cusername:password@ipaddress:port
      plugman config set https-proxy http://domain%5Cusername:password@ipaddress:port

Create a New Android Project

  1. In a command prompt, Navigate to a folder that will hold the project (example: C:\MobileApps)
  2. Create a new project:
    cordova create MyFirstMobileApp com.companyName.MyFirstMobileApp MyFirstMobileApp
  3. Navigate to the new project folder:
    cd MyFirstMobileApp
  4. Add the Android Platform:
    cordova platform add android
ที่มา
https://github.com/simnova/webdevdocs/wiki/Installing-PhoneGap-and-Android-Studio-on-Windows

ไม่มีความคิดเห็น:

แสดงความคิดเห็น