Pen & Paper


Android App

11 Sep 2016

Day 1

A couple of minor issues prior to installing Android Studio on my LMDE 2.

  1. I have more than one version of OpenJDK installed. Android Studio requires version >= 1.8.

    Use `sudo update-alternatives --config java` to change the default JAVA version
  2. I had already defined JAVA_HOME in my .bashrc to use JRE when I installed the EC2 command line tool, Android Studio requires JDK so I had to rename the original JAVA_HOME to JRE_HOME and re-defined JAVA_HOME to point to jdk/bin instead of jre/bin. This was simply done by removing “/jre” at the end of the original string.

    My original “JAVA_HOME”

    /usr/lib/jvm/java-7-openjdk-amd64/jre 

    has now becomes

    /usr/lib/jvm/java-8-openjdk-amd64

Android Studio booted up successfully after installation but with a couple of warning messages:

  1. MaxPermSize option is removed from java version 1.8 and is not supported

  2. OpenJDK shows intermittent performance and UI issues. We recommend using the Oracle JRE/JDK

Item 1 seemed to have appeared only once during the initial boot-up. It did not cause any problem. I assume this can be safely ignored or, alternatively, the option can be commented out in the configuration file studio64-vmoptions found inside the android-stuido/bin folder.

I did some quick research on the net about Item 2. OpenJDK doesn’t seem to create any major issues for people continuing using it for Android Studio. Considering the fact that Google and Oracle are currently hotly engaged in a law suit regarding Android/Java, I have the feeling that Android Studio will eventually ditch Oracle’s JRE/JDK. I decided against installing the Oracle JDK unless some performance issues pop up after.

Finally, the default UI theme IntelliJ looks terrible in my machine. The navigation bar is almost intelligible. Changing the theme to GTK+ under “File->Settings->Appearance & Behaviour->Appearance->UI Options” helps.

Github provides free hosting of a static website for each user and for each project. These websites are generated using Jekyll which will process all files uploaded to an individual user account (master branch of a special repo named USERNAME.github.io) or any project repos with a gh-pages branch.

This short guide will walk through the steps in setting up of a local “Jekyll” installation so that the website can be designed and its content reviewed before committing to Github.

Requirements

Considerations

  1. In configuring Jekyll, it is important to bear in mind that Github’s user page is located at root (USERNAME.github.io) while its project page is served from a sub-directory (USERNAME.github.io/NAME_OF_REPO). The parameter baseurl in *_config.yml* should be set correspondingly as follow:
    • an empty string "" for a user page and
    • "/NAME_OF_REPO" for a project page
  2. To preview the project website locally, it is necessary to temporarily override the baseurl setting using jekyll serve --baseurl "" so that the pages can be found at “localhost:4000”.
  3. The Jekyll engine at Github only supports a selected set of plugins and it may not be the same version as the local installation. To avoid possible conflicts, put gem 'github-pages' in a Gemfile in the repo’s root directory followed by a command bundle install.
  4. Put _site into .gitignore. The folder is generated for the local Jekyll installation only. Jekyll will re-build the site every time following a new upload or commit.

Creating Project Pages

  1. Clone an existing repo
    • $ git clone github.com/user/repo.git
  2. Create and switch to gh-pages branch
    • $ cd repo
    • $ git checkout --orphan gh-pages
  3. Remove all existing files
    • $ git rm -rf .
  4. Scaffold new Jekyll site
    • $ jekyll new .
  5. Make changes and create content
  6. Publish to Github
    • $ git commit -am "new content added"
    • $ git push origin gh-pages

I have created a set of slides for this post using slidify.