官术网_书友最值得收藏!

Building and deployment

Once you are done with your development, you might want to test the application on a real mobile device. Each mobile platform will have a different kind of binary format for the applications. For example, Android application files will have the .apk extension. Similarly, each platform will have a different format for the application.

To create binary files for all platforms from your source code, you need to build the application either locally or by using a cloud service.

If you are building the application locally, you need to run the command-line interface, and the required platform's SDK should be installed on the machine. The CLI supports the following combinations on each operating system:

This table makes it clear that you can't build an iOS application on a Windows machine or a Windows 8 application on a Mac machine. You will need an appropriate machine and the required SDKs installed on the machine.

Assuming you have all the required SDKs installed and configured, to build the application for each of the platform, you can use the build tool of CLI.

Run the following command to build the project for all the platforms added to the project. If you added multiple platforms to the project using the platform add command, the build will happen for all platforms:

C:\example1> phonegap build

If you want to build the application only for a particular platform, say Android or iOS, you can target them inpidually with the following commands:

C:\example1> phonegap build android
C:\example1> phonegap build ios

The build command is the shortcut to prepare and compile the project. You can also build a project in two steps, as shown here. The following set of commands is the equivalent of the build command:

C:\example1> phonegap prepare android
C:\example1> phonegap compile android

Once the build process is completed, the platform-specific app will be available within the project's platforms subdirectory.

Having seen the manual way of building an application, now let's find out about PhoneGap Build. If you want to build and generate application binary files for all platforms, you need to install the inpidual SDKs on your machine, which is not practically possible. That's where we find the PhoneGap Build process handy. PhoneGap Build is an online service for creating binary files for all mobile platforms based on a single source code.

It takes the source code and creates the app file for each of the platforms that you require. It's as simple as uploading your Cordova/PhoneGap project and the cloud service does the rest. The overall functionality of the PhoneGap Build process is provided in the following diagram, which is available at https://build.phonegap.com:

To use PhoneGap Build, you have to follow these steps:

  1. Complete your PhoneGap/Cordova project and ensure you have all the functionalities included in the app as per your design.
  2. PhoneGap Build only requires the contents (HTML, CSS, JavaScript, and images) of your project's assets directory.
  3. If you have any phonegap.js or cordova.js files included in your assets, remove the file as the PhoneGap Build process will automatically inject the required file.
  4. You can upload the project to the PhoneGap Build process and you can see the magic happen.

You can easily download all the application builds for all platforms with a single click:

More details about the PhoneGap Build process can be obtained at http://docs.build.phonegap.com/en_US/.

主站蜘蛛池模板: 沧州市| 星子县| 岳阳市| 兴文县| 石景山区| 太保市| 慈溪市| 兴业县| 盐亭县| 丘北县| 察哈| 磴口县| 和龙市| 无锡市| 张家港市| 四会市| 隆昌县| 台东市| 大埔区| 西青区| 漾濞| 沽源县| 民丰县| 乃东县| 岑巩县| 遵义县| 铜鼓县| 香港 | 乌海市| 贵阳市| 隆昌县| 台安县| 甘洛县| 长春市| 天峻县| 湖口县| 蓬安县| 鄂托克旗| 青川县| 枝江市| 桃园市|