当前位置: 首页 > 文档资料 > Cordova 中文文档 >

Ubuntu Platform Guide

优质
小牛编辑
143浏览
2023-12-01

Initial Release

Welcome to the initial release of Ubuntu platform support in Cordova. With this release, the focus is developing on an Ubuntu system and using the cross-platform workflow discussed in the Overview. This includes adding the Ubuntu platform to your project, adding standard Cordova plugins, and building and running apps for the Ubuntu platform.

Ubuntu SDK

You may also want to install the Ubuntu QtCreator development environment. See developer.ubuntu.com for more info. (The QtCreator SDK is not required to add Ubuntu platform support to your Cordova app.)

Ubuntu Runtime Platforms

Ubuntu is well known for its Desktop environment (for laptops, PCs and such). Ubuntu Touch extends the Ubuntu OS onto phones and tablets. Ubuntu runtime platforms have varying CPU architectures (x86, armhf, etc.). App and plugin code must be compiled appropriately. Support for this broad area is rapidly evolving in Ubuntu.

Latest Information

For the latest information on Cordova app support for Ubuntu runtime platforms, see wiki.ubuntu.com/Cordova.

Development Platform Requirements

For this initial release, the development platform should be an Ubuntu Desktop. Ubuntu 13.10 (codename ‘saucy’) or later is required to enjoy the full set of supported capabilities.

You can install Cordova on non-Ubuntu systems (using npm), but important capabilities are only provided through Ubuntu debian packages at this time.

Cordova Installation

Add the Ubuntu Cordova Personal Package Archive to your Ubuntu system:

$ sudo add-apt-repository ppa:cordova-ubuntu/ppa
$ sudo apt-get update

Install cordova-cli package (and its dependencies):

$ sudo apt-get install cordova-cli

Project Workflow

Create a project

Creates an app in a hello directory whose display name is HelloWorld:

$ cordova create hello com.example.hello HelloWorld

Move into the Project Directory

$ cd hello

Add the Ubuntu Platform

$ cordova platform add ubuntu

Build for Ubuntu

$ cordova build ubuntu

Run the App

$ cordova run ubuntu

Add the Camera Plugin

$ cordova plugin add cordova-plugin-camera
``