Sunday, 19 April 2015

Install Android Studio in Ubuntu

Many Android developers like me switch to Android Studio from Eclipse for better performance and integration. Android Studio has many new features that can speed up your android development.

Many times Eclipse hangs and we need to kill and and start again but this does not happen in Android Studio. Android Studio also has some nice preview when you creating layouts for the app. It has gradle support which eliminate the mess of including the libraries.

At start, you found Android Studio somewhat difficult but once you use it for few days, you will never go back to Eclipse(My personal experience!). The reason behing the difficulty of Android Studio is that the project structure and android project is totally different from Eclipse. But you got it easily after few days. Follow this thread if you need more info. on Android Studio and Eclipse difference.

Now get back to our tutorial, how to install Android Studio in Ubuntu. Currently I have Ubuntu 14.10 and Android Studio is working completely fine. Follow the below steps.

1. Download Android Studio from Google

You can find the latest version of Android Studio from official Android website here.


Now go to bottom of the page and find section "All Android Studio Packages" and download .zip file of Linux Platform.

2. Extract the .zip file into your hard drive and run from Terminal.

Now you have to extract the downloaded .zip file of Android Studio to one of your folder in hard drive. Now to run Android Studio for first time you need to run the .sh file from /bin folder from terminal. Below screenshot gives you the idea about that.

And it will open the Android Studio.

Now it will ask you for few preference and then at last it will ask to download some Android SDK component in case of you don't have them already. Follow the screenshots.

3. Create launcher icon for Android Studio.

Once you open android studio from terminal as per above instructions, you can create launcher icon following way. 

Go to Tools menu or press "Alt+t" from your keyboard. It will open Tools menu where you can find "Create Desktop Entry..." option. Please select it and confirm that you want to create launcher icon for android studio. After that open your dash by pressing master key(windows key) and you can find android studio icon there.

Friday, 10 April 2015

Adjust screen brightness in Ubuntu using hotkeys

In almost all laptops you can find hotkeys(combination of function and other special key in your laptop that varies according to the manufacturer) that provide you special features like adjust sound, adjust brightness, toggle wifi and bluetooth. Now when you install Ubuntu in such laptop many time all hotkeys combination may not work.

I have Acer aspire series laptop and I installed Ubuntu in it. All the hotkeys combinations are working fine except brightness hotkeys using function key. But I can alter screen brightness using following command in terminal. 

        sudo setpci -s 00:02.0 F4.B=xx

In above command xx= all hexadecimal value between 00 to ff [00=highest brightness  ff=lowest brightness(total dark)]. For more information check my post

But for that you need to remember this command or need to write down it somewhere and enter it every time you start Ubuntu. So the hotkeys will be more preferrable over this solution.

For that you need to edit grub file. To open that grub file enter the following command in the terminal.

        sudo gedit /etc/default/grub

It will ask for the password of you user and it open gedit with grub file. You need to find two variable and add their value as below. If the variables are already there just mark them as comment by writing # at the start of the line.

    GRUB_CMDLINE_LINUX_DEFAULT="quiet splash acpi_backlight=vendor"


Save the file and close it. Now you have to update the changes in grub file by firing following command.

        sudo update-grub

Now when you restart the Ubuntu and open it next time, the hotkeys for brightness should be work fine. 

Friday, 3 April 2015

Sublime Text: Awesome text editor in Ubuntu

As a Android developer many times I need to do some coding in PHP and I use gedit(default text editor in Ubuntu) which has nice syntax highlighting. But somewhere it is not specially designed for PHP.

So I searched for any specific text editor which supports all PHP function and syntax. And at last I found Sublime Text is one of the best text editor for it. Because it has many advance feature apart from PHP sytax highlighting. It has many great features like finding keyword in the code, replacing texts, formatting the code, proper indention, etc.

As you install it and use it for some time, you will come to know about many other handy features. I will guarantee you that you can adopt it in 1 one or two days. You can also change the theme of editor that changes syntax color and background color.

The best feature I haven't seen in any other text editor is the right panel in Sublime Text which indicates you many things like length of your code, selection(if you select more than one page, it shows you how much part is selected so you can get some idea), current position of your cursor in the file which helps you when you have very lengthy file.

The lastest version 3 is just released and work awesome. Here is the screenshot tour of Sublime Text.