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
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.
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:
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