MDN wants to talk to developers like you:

运行 Gaia 的不同方式

您可以通过 App Manager中,在 Desktop Firefox 中直接运行,作为专用桌面版本(Desktop B2G), 在仿真器中, 或在可兼容的移动设备中运行 Gaia。本文则对上述每个方式如何实现的进行总结,以及链接到更深的内容。


Some of the solutions for running Gaia detailed in this article are closer to the experience on a real device than others. The order of ease for running is as follows:

  1. Gaia in simulator
  2. Gaia in Desktop Firefox
  3. Gaia in B2G Desktop
  4. Gaia in Emulator
  5. Gaia flashed on phone
  6. Gaia+Gecko flashed on phone

The order of “how close it is to the shipped product” is exactly the opposite of this. Depending on the feature you’re working on, you’ll have to find the environment that suits the problem.

在 App Manager/Firefox OS simulator 中使用 Gaia

The quickest way to try Gaia is via the Firefox App Manager.

App Manager is a developer tool available in Firefox for Desktop. It provides a number of useful tools to help you test, deploy and debug HTML5 web apps on Firefox OS phones and the Firefox OS Simulator, directly from your browser.

In desktop Firefox Browser 26+, open the App Manager using Tools > Web Developer > App Manager. Tap Start Simulator (once you've installed it) and you are ready to experience Firefox OS.

B2G Desktop

B2G Desktop is a desktop build of the app runtime used on Firefox OS devices which you can use to run Gaia on your desktop computer.

You can download a nightly build of B2G desktop from the Firefox Nightly site. Depending on what version you are targeting, you may want a specific version of latest-mozilla-b2g18. There are builds for Linux (32 bit and 64 bit), Mac OS X and Windows.

Nightly builds come packaged with a recent version of gaia. Once you've downloaded the archive, all you need to do is extract it to a folder and run the b2g binary from the extracted folder.

$ cd b2g
$ ./b2g

To run B2G with your own version of Gaia for development purposes you first need to build a profile from your clone:

$ cd /path/to/gaia
$ DEBUG=1 DESKTOP=0 make

This will generate a directory in your gaia directory called profile. The DEBUG part runs Gaia as hosted apps on a built-in web server, rather than the default packaged apps which have to be re-packaged after every change. You can find the path to the profile directory by taking a look at last line of output after running the above command, which should look like:

Profile Ready: please run [b2g|firefox] -profile /path/to/gaia/profile

You can then run B2G Desktop with your generated profile like so:

$ ./b2g /path/to/gaia/profile

If you want to you can build your own B2G desktop from source.

Note: On Mac OS X, the b2g binary will be inside To run B2G Desktop on this platform you will need the following command:
./ /path/to/gaia/profile

在 Desktop Firefox 中使用 Gaia

It's also possible to run Gaia inside of Firefox. This gives you the advantages of having a rapid development cycle, as well as standard web development tools and debuggers. See Running the Gaia codebase for details on how to do this.

Note: FoxBox is a Firefox OS build environment contained in a VM (Virtual Machine), powered by Vagrant and VirtualBox. This has many advantages, but the main one is that it does a lot of configuration for you, leaving you to get on with development work. For full instructions, read the FoxBox GitHub repo README.

在真实设备中烧写 Gaia

要在真实设备上烧写新版本的 Gaia 需要下列步骤:

  1. 首先请确认您本地的电脑上有 Gaia 仓库,并且 ADB 已安装。
  2. 确认您已经使能  Debugging via USB 选项。
  3. 通过 USB 将您的设备连接到电脑上。
  4. 如果您有一个连接的设备,可以继续下面的命令。或者您( Windows 或 Linux 系统的用户)可能需要检查下 OEM USB 驱动页面来对您电脑中的 USB 驱动进行正确配置。
  5. 在 Gaia 仓库中运行下面命令以对手机进行复位以及更新您的 Gaia 源码:
    $ make reset-gaia
  6. 要测试非 System app, 您可以在不重启设备情况下运行下面命令来安装:
    $ make install-gaia
  7. 如果您只是想安装一个指定的 app, 可以通过 APP 变量来完成, 就如下面的命令:
    $ make install-gaia APP=browser

要检查您的设备是否已正确的通过 USB 连接, 可以键入下面命令:

$ adb devices


List of devices attached
emulator-5554  device

编译 Gecko 和 Gaia 并在仿真器或真实设备中使用

如果您有一个可兼容的移动设备,则可以 编译和安装您自己的 Firefox OS 版本 并且将其运行在仿真器或推送到实际设备上。


 此页面的贡献者: chrisdavidmills, ReyCG_sub
 最后编辑者: chrisdavidmills,