Getting started with Cordova

Source: Internet
Author: User

Getting started with Cordova

1. Install JDK 8 and configure Environment Variables

JAVA_HOME C:\Program Files\Java\jdk1.8.0_144 CLASSPATH .;%JAVA_HOME%\lib\dt.jar;%JAVA_HOME%\lib\tools.jar;Path %JAVA_HOME%\bin;

2. Install android sdk and configure environment variables using the adt-bundle-windows-x86_64-20140702 integration package

ANDROID_HOME  D:\work\adt-bundle-windows-x86_64-20140702\sdkPath %ANDROID_HOME%\tools;%ANDROID_HOME%\platform-tools;

3. Install gradle-4.2

GRADLE_HOME D:\work\gradle-4.2Path %GRADLE_HOME%/bin;

4. Install node. js

Path D:\work\node-v6.11.3-win-x64\;

5. Install cordova

npm install -g cordova --registry=https://registry.npm.taobao.org

The cnpm method is found online, but an error is reported.
Terminal input confirmation: cordova-v

Create the first application

Create an application

cordova create first com.example.first firstApp

Add Platform

cd firstcordova platform add android --registry=https://registry.npm.taobao.org --nofetch

(This step is very slow)

Compile an app

cordova build android

(There will be many problems in this step. Solve the problem one by one based on the reported errors. In my first example, I encountered the following problems)

1. Downloading https://services.gradle.org/distributions/gradle-3.3-all.zip failed, manually download
2. If the jvm memory is insufficient, adjust the settings under firstApp \ platforms \ android \ cordova \ lib \ builders \ GradleBuilder. js.
Row 59 args. push ('-Dorg. gradle. jvmargs =-xmx2048m'); 2014 is 1024
3. Insufficient android support for the sdk, which can be installed through SDK Manager.exe


Run app
Run cordova emulate android on the simulator
Run the cordova serve android browser on the browser to access http: // localhost: 8000.
Run cordova run android on a real machine

Notes for importing firstApp using eclipse
1. Do not select Copy projects into workspace. Simply develop the firstApp.
2. The source code of www under firstApp must use cordova to build android before it can be packaged into firstApp \ platforms \ android \ assets \ www for release,
Therefore, before development, select which directory to use as the development site. Do not edit the two directories at the same time to prevent the www under firstApp from overwriting the edited www under assets, resulting in loss of development code.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.