Mustafa Mohammadi Mustafa Mohammadi - 4 months ago 43
Linux Question

Best distribution of Linux for Android Development

I'm an Android Developer and I'm using Windows currently. I would like to switch to Linux. I need to know which distribution of Linux is the best for developing android apps?

Thanks

Answer

Although just about every Linux distro will work, some will be easier for you due to the packages they have installed by default (which means less time tinkering and troubleshooting for you and more time just working / coding).

With that, I would recommend Ubuntu or Linux Mint. Lots of people use them so it has a lot of use (and is therefore pretty decent) and there is a big community to ask questions if you need to. I personally just installed Linux Mint 18 and am having a easy time developing in Android.

Another piece of important advice: Get rid of the Open JDK installed in whatever distro you go with and then install Oracle's JDK! The reason is because Oracle's JDK is fullproof for Android development while the Open JDK can sometimes give you compatibility issues.

Here is how you would do that on whatever distro you go with:

Get rid of the Open JDK that may be installed:

sudo apt-get update && apt-get remove openjdk*

Download Oracle JDK from here. You are looking for a linux version with tar.gz extension. Also choose the right version from 32-bit (x86) and 64bit (x64) one.

 sudo mkdir -p /opt/java

Move the unzipped download to where it will live (I put the version number in this example):

 sudo mv jdk1.8.0_91 /opt/java

Make this JDK your system's default:

sudo update-alternatives --install "/usr/bin/java" "java" "/opt/java/jdk1.8.0_91/bin/java" 1 

then

sudo update-alternatives --set java /opt/java/jdk1.8.0_91/bin/java

Finally, test your Java version:

java -version

After you get Oracle Java installed you'll need to install your IDE for Android development. There was once a time when Eclipse was the way to go, but these days Android Studio is really where it's at. You can install Android Studio from source or to make your life easier you can use a PPA.

If you choose Ubuntu, Linux Mint or another Debian Based distro you can use the following method with the following PPA:

  • sudo add-apt-repository ppa:paolorotolo/android-studio
  • sudo apt-get update
  • sudo apt-get install android-studio

That is it. Now just launch Android Studio and update all your SDKs and the like.

If you don't want to add any PPAs you can do the following:

  • Download Android Studio Pack from official site: https://developer.android.com/studio/index.html
  • Extract the compressed file. You will see the "android-studio" directory. Move that "android-studio" dir to any location on your system where you want to install it (I recommend /opt).
  • Navigate into the directory where you moved the dir and go to "android-studio/bin". Right-click in to the window and select "Open in Terminal". Now a Terminal will appear.
  • Type ./studio.sh in the Terminal.
  • Now the Android Installation Wizard will start. You can customize the installation as you wish.
  • The Install Wizard will start to download the SDK and other up to date Android APIs. Click Finish when done.

That is it! Just make sure to create a Shortcut if you would like!

-Good luck!

Comments