The creation of Android Cordova plugin development Project

Source: Internet
Author: User

To create a project using the command line

Cordova the command to create a project is

Cordova Create <dir> <packageName> <projectName>

    • First parameter < dir;: Name of the project directory folder
    • Second parameter < PackageName;: Package name of the project
    • The third parameter < ProjectName;: Name of the project
      So, we create a HelloWorld project, through the command line CD to the project to create the root directory, and then execute the command

Cordova Create HelloWorld Com.example.helloworld HelloWorld

The project directory structure is as follows:

Next, we CD into the project folder to familiarize ourselves with several commands:

    • View installed platforms and platforms that can be supported

Cordova Platforms List

    • Add platform Support

Cordova Platforms Add Android
Cordova Platforms Add Android

The add command is followed by platform parameters, which platforms can be added, which can be viewed from the previous List command.

    • Remove platform Support

Cordova platforms Remove Android

The Remove command allows you to remove a supported platform.
After adding the Android platform, the directory structure is as follows:

    • Compiling the project

Cordova Build

If you do not have Gradle 2.1.1 installed, this time, when the command is executed, it will download Gradle, which may wait longer. can also be manually installed, specific methods, you can check the information or view my blog using Android Studio compiled fresco inside there are simple mentioned.

Run the project command line run
    • Turn on the Android emulator or connect to the real device
    • Running the Run command
Cordova Run Android
Run with Eclipse

Import->android->existing Android Code into Workspace

The import directory is the platforms\android under the project directory you created
Then tick the top two items and note that thecopy projects into workspace do not tick .

Issues that occur at run time:

Installation Error:install_failed_version_downgrade

The console reported the error, and the workaround is to uninstall the app that was installed when run with the Run command.

Run with Android Studio (recommended)

File->open->open Project

Directly click on the Green Triangle button to run.
It is recommended to use Android Studio to develop, if you still stay in eclipse, quickly turn it ~
The IDE behind the custom plugin development is also Android Studio.

Last previous run result diagram:

Summarize

The main two commands in this section are
1. Cordova Create Project
2. Cordova platforms add Android added platform support

The creation of Android Cordova plugin development Project

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.