Install Android Studio in Ubuntu 14.04

Android Studio is the official development tool for Android developers. This tutorial shows you the way to install the latest Android Studio in Ubuntu 14.04. Solutions for some common problems are provided at the end of this tutorial. Android Studio requires Oracle JDK 7.0 or latest in your system. If you do not have JDK, follow this link and install the Java first.



Step #1:
Download the latest Android Studio package from the official link.

Step #2:
Extract the Android Studio zip file in your home directory.

Step #3:
If you want Android Studio to be available for all users you need to move it to the /opt/ directory. To move it enter the following command in Terminal.
sudo mv android-studio /opt/

Step #4:
Enter this command in Terminal.
gedit android-studio.desktop

Step #5:
Copy and paste the following code into the opened gedit, save the document and exit the gedit.
[Desktop Entry]
Name=Android Studio
Type=Application
Exec=/opt/android-studio/bin/studio.sh
Terminal=false
Icon=/opt/android-studio/bin/studio.png
Comment=Integrated Development Environment
NoDisplay=false
Categories=Development;IDE;
Name[en]=Android Studio
Name[en_US]=Android Studio

Step #6:
Now enter the following command to install the android-studio.desktop into the applications directory.
sudo desktop-file-install android-studio.desktop
Now you are ready to run your Android Studio. Search for Android Studio in Unity dashboard and open it. Follow the instructions to download Android SDK tools and to create your first virtual device.

Possible Errors
Error 1:
Once completed, create a sample project and if you got any build errors saying something like this...
Execution failed for task ':app:mergeDebugResources'.

>   /path/to/application/app/build/intermediates/exploded-aar/com.android.support/appcompat-v7/19.1.0/res/drawable-hdpi/abc_tab_selected_focused_holo.9.png: Error: Cannot run program "/usr/share/android-studio/data/sdk/build-tools/android-4.4W/aapt": error=2, No such file or directory
You need to install 32 bit libraries in your 64 bit Ubuntu to support some tools in the Android SDK. Enter the following command to install the required libraries and after the installation restart your Android Studio.
sudo apt-get install libc6-i386 lib32stdc++6 lib32gcc1 lib32ncurses5

Error 2:
If there are any errors like the following:
Execution failed for task ':app:mergeDebugResources'.
Error: Failed to run command:
/home/giacomotb/Programs/android-studio/sdk/build-tools/android-4.4/aapt s -i /home/giacomotb/AndroidStudioProjects/ProvaDBCinema/app/build/exploded-bundles/ComAndroidSupportAppcompatV71900.aar/res/drawable-hdpi/abc_list_selector_disabled_holo_light.9.png -o /home/giacomotb/AndroidStudioProjects/ProvaDBCinema/app/build/res/all/debug/drawable-hdpi/abc_list_selector_disabled_holo_light.9.png
**Error Code:127**
Output:
/home/gobinath/Android/Sdk/build-tools/android-4.4/aapt: error while loading shared libraries: **libz.so.1: cannot open shared object file: No such file or directory**
Execute the following command in terminal:
sudo apt-get install lib32z1

Error 3:
Android Studio 1.3 may execute 'Gradle : Resolve dependencies' forever. It can be fixed by executing following commands in your Terminal:
sudo dpkg --add-architecture i386
sudo apt-get install libncurses5:i386 libstdc++6:i386 zlib1g:i386

Error 4:
Thanks to "fidelite" for sharing this problem with the solution.
If you get any error messages like:
Built-in HTTP server on custom port 63342 disabled
Ensure that the port 63342 is free in your computer. Check other applications/services and your firewall settings. Once you make the port free, restart the Android Studio.

For any other errors:
Try the solution for Error 1 and 2 if you get any other errors. If your problem is not fixed, please comment below your problem.

Enjoy the amazing features of Android Studio.
Previous
Next Post »

10 comments

Write comments
fidelite
AUTHOR
September 8, 2015 at 9:14 PM delete

thanks, my problem is as follows
Built-in HTTP server on custom port 63342 disabled: Cannot start built-in HTTP server on custom port 63342. Please ensure that port is free (or check your firewall settings) and restart Android Studio

Reply
avatar
Gobinath
AUTHOR
September 10, 2015 at 6:58 AM delete

Thank you for sharing the problem you have faced along with the solution. It will help others, if they have same issue.

Reply
avatar
Mohamad Handy N
AUTHOR
September 15, 2015 at 8:37 PM delete

thanks, i have a problem is as follows

Invalid Gradle JDK configuration found. Open Gradle Settings

ERROR: Platform SDK does not point to valid JDK(/usr/lib/jvm/java-1.7.0-openjdk-i386)

open file

I've been looking for a solution in Google, but after I try the result is still the same.



do you have a solution about this problem?

Reply
avatar
Gobinath
AUTHOR
September 16, 2015 at 1:14 PM delete

Hi,
I highly recommend you to install Oracle JDK and point the JDK path in
File > Project Structure > JDK location of Android Studio.
To install Oracle JDK, follow this link: http://www.javahelps.com/2015/03/install-oracle-jdk-in-ubuntu.html

If it is not solving your problem, please let me to know.

Reply
avatar
Mohamad Handy N
AUTHOR
September 16, 2015 at 7:57 PM delete

I can fix that, thank you so much.

If i have a new problem again or my friend have a problem to install android studio i will share in this Discussoon again.

Thanks :)

Reply
avatar
Gobinath
AUTHOR
September 16, 2015 at 10:13 PM delete

You're welcome :) and thank you for your contribution :)

Reply
avatar
Disha Garg
AUTHOR
February 1, 2016 at 1:19 PM delete

Hello, I am facing the same problem and have not been able to fix it till now. I checked the port 63342 is free. Also, I turned off my firewall. Yet it shows the same error. Please help

Reply
avatar
Gobinath
AUTHOR
February 1, 2016 at 8:33 PM delete

I haven't face this problem so I am unable to give you the exact solution. However this is my suggestion.
1. Go to File -> Settings
2. Select the category
3. Build, Execution, Deployment -> Debugger
4. Change the default port 63342 to something else

Reply
avatar
anil
AUTHOR
December 24, 2016 at 1:22 AM delete

i have just installed and run the first "hello world" program and i am getting three errors as follows

1. Error:(2) No resource identifier found for attribute 'layout_behavior' in package 'com.example.anil.myfirstapp'
2. Error:(12, 26) No resource found that matches the given name (at 'layout_behavior' with value '@string/appbar_scrolling_view_behavior').
3. Error:Execution failed for task ':app:processDebugResources'.
> com.android.ide.common.process.ProcessException: Failed to execute aapt

Reply
avatar
Gobinath
AUTHOR
December 25, 2016 at 6:24 AM delete

Install the following 32bit libraries and try again.

sudo apt-get install lib32gcc1 libc6-i386 lib32z1 lib32stdc++6
sudo apt-get install lib32ncurses5 lib32gomp1 lib32z1-dev lib32bz2-dev

Reply
avatar

Contact Form

Name

Email *

Message *