How to fix font of IntelliJ

Before and after fixing font in Android Studio
Before and after fixing font in Android Studio

Problem

IntelliJ and other tools based on it, like Android Studio, look terrible on Ubuntu 14.04 with OpenJDK 7. The font rendering in the UI is terribly aliased and is a pain on the eyes. This is surprising since Eclipse renders beautifully using the same JDK and Ubuntu system.

Solution

Eclipse uses GTK for its GUI while IntelliJ and Android Studio use Swing. Thankfully, this situation can be fixed.

  • Replace the OpenJDK with a version in which font rendering has been fixed:
$ sudo apt-get purge openjdk-7-jdk
$ sudo add-apt-repository ppa:no1wantdthisname/openjdk-fontfix
$ sudo apt-get update
$ sudo apt install openjdk-7-jdk
  • Open the studio64.vmoptions file and change the anti-aliased font setting to -Dawt.useSystemAAFontSettings=on. Other options suggested by users online did not work for me.

Now IntelliJ or Android Studio should render the font much better. I still notice a bit of aliasing with Consolas, but it is manageable.

Tried with: Android Studio 1.4 and Ubuntu 14.04

Selected device is incompatible error in Android Studio

Problem

I was following a tutorial to learn using Android Studio. I connected my Android device which has USB Debugging enabled. After creating a new project, I tried to Run it. In the Device Chooser window, I could see my device listed. However, in the Compatible column, it was shown as incompatible and the message below read “The selected device is incompatible”. This was even though the minimum SDK version was lower than the SDK/OS of my device.

Solution

Follow all the steps of the Using hardware devices guide:

  • Enable debugging in the app/build.gradle file.
  • Add new UDEV rules for your device. You will need to look up the Vendor ID of your phone and create the /etc/udev/rules.d/51-android.rules file.
  • Reconnect the device and it will prompt to accept a RSA key from the computer. Accept it.
  • Check if the device is listed using the adb tool:
$ ~/Android/Sdk/platform-tools/adb devices

Now try to Run the app on the device. In the Device Chooser window, you should be able to see the full device name, compared to the codename which was shown earlier. This is a clue that everything is working. Your app should appear on your device in a few moments!

Tried with: Android Studio 1.4, Moto G2 XT1068 and Ubuntu 14.04