Environment setup

In this section you will learn how to setup your environment and begin developing apps for KaiOS.

Install Firefox

You will need to get the Firefox v59 or older version for KaiOS implementations, to download these versions, you can get them through Mozilla FTP.

Install package on Linux

After downloading the chosen version, you must unpack the package with the command:

$ tar jxvf firefox-*.tar.bz2 -C /opt

Create a shortcut to facilitate program execution

$ sudo ln -sf /opt/firefox/firefox /usr/bin/firefox

Setting WebIDE

Firefox's WebIDE is a necessary development tool to inspect your app, as well as see the console, debugger, and others.

  • Follow the instructions in WebIDE to setup and learn more about WebIDE.

Installing make

Make is a necessary tool to run KaiOS. Execute the following commands on the terminal to install it.

$ wget http://ftp.us.debian.org/debian/pool/main/m/make-dfsg/make_3.81-8.2_amd64.deb
$ sudo dpkg -i make_3.81-8.2_amd64.deb
$ sudo apt-mark hold make

Setting the required architectures

$ sudo dpkg --add-architecture i386
$ sudo dpkg --add-architecture amd64

Installing dependencies

There are some necessary dependencies to complete your environment for running Gaia. Execute the command below on your terminal and all these dependencies will be installed.

$ sudo apt install --no-install-recommends autoconf2.13 bison bzip2 ccache curl flex gawk gcc g++ g++-multilib git lib32ncurses5-dev lib32z1-dev libgconf2-dev zlib1g:amd64 zlib1g-dev:amd64 zlib1g:i386 zlib1g-dev:i386 libgl1-mesa-dev libx11-dev make zip lzop libxml2-utils openjdk-8-jdk nodejs unzip python

Setting ccache

$ ccache -M 10G

Installing ADB and fastboot

$ sudo apt install android-tools-adb android-tools-fastboot

Setting USB access

$ wget -S -O - https://raw.githubusercontent.com/cm-b2g/B2G/1230463/tools/51-android.rules | sudo tee >/dev/null /etc/udev/rules.d/51-android.rules; sudo udevadm control --reload-rules
  • Plug the device in your computer using a USB cable

  • Use the command

    $ lsusb

    on the terminal to get the Vendor ID. Example of a result: Bus 001 Device 014: ID 22b8:2e76 Motorola PCS ===> vendor ID is 22b8

  • Log in as root and edit this file: /etc/udev/rules.d/51-android.rules

  • In the file above put a new line using the vendor ID that you got before. Example: SUBSYSTEM=="usb", ATTR{idVendor}=="22b8", MODE="0666", GROUP="plugdev"

  • Now execute:

    $ sudo chmod a+r /etc/udev/rules.d/51-android.rules
  • Create the following file in your HOME dir (not as root)
    $ nano ~/.android/adb_usb.ini
  • Put the value of vendor ID on this file using hex format. Example: 0x22b8, where 22b8 is the vendor ID that you got before.

  • Use the command 'adb devices' on the terminal to list all devices connected on your PC. Your device should be listed and is ready to receive Gaia apps or use it on WebIDE.

Connecting to Device

Open the Settings app and follow this flow:

Device > Developer > Debugger > ADB and DevTools

After that, you should see your device on the USB DEVICES list.

Using WebIDE with your device

  • Start WebIDE. If everything is fine, you can see your device in the 'USB Devices' section.

  • Click on a device name and all apps will be listed on the left side.

  • Choose one app to run, inspect, debug, test, etc.

Connection Errors

For more information about the ADB connection fail error see this link

This extension will re-enable extensions that were disabled on May 3, 2019 for Firefox versions 52 - 56.