Tag: Ubuntu

  • Android: Facebook SDK “Invalid Key Hash” on Ubuntu


    I kept getting a different Facebook key hash from the one being actually generated by my debug app when it runs. Turns out I’ve been entering the wrong keystore password.

    To get your key hash for Facebook SDK on Ubuntu, run the following command:

    In case you don’t have the keytool program yet, you’ll see the following message:

    The program ‘keytool’ can be found in the following packages:
    * gcj-5-jre-headless
    * openjdk-8-jre-headless
    * gcj-4.8-jre-headless
    * gcj-4.9-jre-headless
    * openjdk-9-jre-headless
    Try: sudo apt install

    What I did was install openjdk-9-jre-headless by running the command:

    Wait for your selected program to install and try the first command again to generate key hash for Facebook on Ubuntu.

    When prompted for keystore password, try to use “android”.

  • Ubuntu: Show current Git branch on Terminal prompt


    There are times when I keep running git status or git branch to check which branch I’m on and I just found that I could do something to show the name of my current Git branch on my Terminal prompt, thanks to a colleague.

    In the following screenshot I’m working in the directory “sample_app”, on Git branch that is named “static-pages”:

    ubuntu-terminal-prompt-git-branch-

    In Ubuntu, here’s how I did it.

    Create .bash directory in Home:
    mkdir ~/.bash

    Go to the new directory
    cd ~/.bash

    Clone the git-aware project from GitHub:
    git clone git://github.com/jimeh/git-aware-prompt.git

    Edit your .bashrc file. I use Vim editor for this:
    vim ~/.bashrc

    Add the following to the top of your .bashrc:

    If you want colored prompts, add the following to the bottom of your .bashrc:

    Otherwise, if you doon’t like colors, use this instead:

    Open a new Terminal tab or restart Terminal. Navigate to any directory that has a Git repository and your Ubuntu’s Terminal prompt should now show the current Git branch’s name.