Skip to content

Developing Adapt It Mobile on Linux

Erik Brommers edited this page Jun 6, 2015 · 9 revisions

Following are the basic steps to setting up your machine to develop Adapt It Mobile on Linux (for the Android platform). This is for Ubuntu 13.10; other distros might need other steps.

  1. Open a browser window and navigate to http://nodejs.org. On that page, click the INSTALL button and save the file node-v0.10.22.tar.gz to your Downloads directory.

  2. Open the file node-v0.10.22.tar.gz with Archive Manager and extract the contents into your home directory.

  3. Open a Terminal window and type the following commands to install node.js:

    cd ~/node-v0.10.22

    ./configure

    make

    sudo make install

  4. In the Terminal window type in the following commands to install the bulk of the tools you’ll need and clone the Adapt It Mobile source into the ~/dev directory (you can substitute another directory if desired):

    sudo apt-get update -y

    sudo apt-get install git npm inkscape -y

    sudo npm install -gf cordova i18next i18next-conv

    sudo npm update -g

    mkdir -p ~/dev

    cd ~/dev

    git clone https://github.com/adapt-it/adapt-it-mobile.git

  5. In that same Terminal window, check to see if there is a version of the Java developer kit (JDK) installed, and if so, what version:

    java -version

  6. If there is no Java installed or if it’s the older 1.6.x version (which is unfortunately the target for a lot of security exploits), you’ll want to install the newer 1.7.x version. In the Terminal window, type the following:

    sudo add-apt-repository ppa:webupd8team/java

    sudo apt-get update

    sudo apt-get purge oracle-java6-installer

    sudo apt-get install oracle-java7-installer

    sudo update-java-alternatives -s java-7-oracle

[whm Note:] An alternative to using Oracle's Java is to just use the Ubuntu (Linux Mint 13) distribution of the openjdk-6-jdk and ant. The above 5 steps reduce to just a single step:

sudo apt-get install default-jdk ant

  1. Back in the Terminal window, download and install the Android SDK. Note that the last command in this section (android update sdk) installs EVERYTHING, with all that implies – lots of disk space and lots of time. You have been warned.

    wget http://dl.google.com/android/android-sdk_r22.2.1-linux.tgz

    cd ~

    tar zxfp dev/android-sdk_r22.2.1-linux.tgz

    cd ~/android-sdk-linux

    tools/android update sdk --no-ui

    Next, update the environment variables on your system so that Android will work properly. In the Terminal window, type the following:

    sudo gedit ~/.profile

    In the .profile file, add the following 2 lines:

    PATH=$PATH:$HOME/android-sdk-linux/tools:$HOME/android-sdk-linux/platform-tools

    ANDROID_HOME=$HOME/android-sdk-linux

    Save the file and exit gedit, then log out / log back in. Open up a Terminal window and type “android” – you should see the android SDK manager window open up if the path is pointing to the correct directory.

  2. [amd64 builds of Ubuntu] Android's build process looks for some 32-bit libraries, that need to be manually added for 64-bit flavors of Ubuntu. The libraries you need depend on which version of Ubuntu you're running on.

    For Ubuntu 13.04 and earlier (source: http://askubuntu.com/questions/147400/problems-with-eclipse-and-android-sdk):

    sudo apt-get update

    sudo apt-get install ia32-libs

    For Ubuntu 13.10 (source: http://askubuntu.com/a/165536/1599):

    sudo apt-get update

    sudo apt-get install libc6:i386 libstdc++6:i386 zlib1g:i386

  3. [Optional] Install the Brackets editor. Open an internet browser and go to: http://download.brackets.io/. Click on the Download Brackets button to download Brackets on your computer. If prompted, open the .deb file in the Ubuntu Software Center or Package Manager (if you are not prompted, you will need to open the .deb file manually) and install Brackets on your computer.

  4. [Optional] Schedule a cron job to regularly update the npm packages. These are not updated automatically, but a call to “npm update” will update them. Add this call to your daily cron tasks by doing the following: a. In the Terminal window, type:

`crontab -e`

b. This will bring up a crontab file in your default editor. Add the following line to your crontab file, then save and exit:

`@daily npm update -g cordova`