Creating an application launcher icon for Android Studio

I currently launch android studio by going to /path-to-android-studio/bin and running ./studio.sh and it works fine.

However, I want to create a launcher on the Dash and side menu for launching it easily.

After going through some other questions like this, I first tried the Tools > Create Desktop Entry method. It did create an entry on the dash, but somehow Android Studio does not launch by clicking on it. If it’s of any help, I am pasting the jetbrains-android-studio.desktop entry this method created in the /usr/share/applications directory:

[Desktop Entry]
Version=1.0
Type=Application
Name=Android Studio
Icon=/home/jayant/Android/android-studio/bin/androidstudio.svg
Exec="/home/jayant/Android/android-studio/bin/studio.sh" %f
Comment=Develop with pleasure!
Categories=Development;IDE;
Terminal=false
StartupWMClass=jetbrains-android-studio

When this didn’t help, I deleted the above mentioned .desktop entry and tried the method mentioned in this blog post, which required me to create the following jetbrains-android-studio.desktop file and paste it in /home/jayant/.local/share/applications directory

[Desktop Entry]
Version=1.0
Type=Application
Name=Android Studio
Exec="/home/jayant/Android/android-studio/bin/studio.sh" %f
Icon=/home/jayant/Android/android-studio/bin/idea.png
Categories=Development;IDE;
Terminal=false
StartupNotify=true
StartupWMClass=jetbrains-android-studio

This also created an icon in my Dash but Android Studio refuses to launch with this also. Is there something I am doing wrong? I just want a simple launcher icon for Android Studio on my dash! I am using Ubuntu 14.04.

Asked By: jayant

||

This is my Android Studio desktop file looks like

[Desktop Entry]
Version=1.0
Type=Application
Name=Android Studio
Exec="/home/user-name/android-studio/bin/studio.sh" %f
Icon=/home/user-name/android-studio/bin/idea.png
Categories=Developement;IDE;
Terminal=false
StartupNotify=true
StartupWMClass=jetbrains-android-studio
Name[en_G0]=android-studio.desktop

And it works perfectly fine. make sure all the paths given are true and save it in the /usr/share/applications directory itself.

Answered By: theDistantStar

All you did “wrong” was that you didn’t drag the jetbrains-android-studio.desktop file from the directory in which Android Studio created it into the Launcher and drop it where you want it to appear. You can use Ubuntu’s Files application to find, drag and drop the .desktop file.

Notes:

  1. If you opted to “Create entry for all users” when requesting AS create it, the file will be

    -rw-r--r-- root root /usr/share/applications/jetbrains-android-studio.desktop
    

    Otherwise it will be

    -rw-r--r-- jayant jayant /home/jayant/.local/share/applications/jetbrains-android-studio.desktop
    
  2. Assuming your user:group is jayant:jayant . Not executable. No need to relogin, restart the machine or desktop, etc. If it still doesn’t work (no/wrong icon, fails to launch) open the .desktop file and check that its paths point to the correct files.

  3. Then file a bug report with Ubuntu asking that its Desktop include a simple feature for installing Launcher icons with a single click and options for editing its resource identifiers :).

Answered By: Matthew

I had the same problem with Android Studio on Ubuntu 14.04. Since Android Studio is a customized version of IntelliJ IDEA, I searched for similar problems with creating a Launcher entry for IDEA on Stack Overflow and I found this question:

Intellij launcher doesn’t work on unity?

Two of the answers to that question mention that the Launcher entry doesn’t work because it can’t find the JDK installation directory. That location can be defined system-wide in /etc/environment or per-user in their .bashrc file. I think the users that report that their Android Studio desktop entry works without any tweaking are probably using an system where the JDK location has been set on a system-wide basis.

If you don’t have permission to edit /etc/environment or prefer to keep your customizations local to your login, it’s still an easy fix.

  • create an Android Studio .desktop file for your login by using Studio’s Tools -> Create Desktop Entry... menu item
  • define the location of the JDK by setting the JAVA_HOME or JDK_HOME environment variable in your .bashrc file
  • edit the Android Studio .desktop file and add bash -i to the beginning of the Exec statement.

The bash -i creates a new shell that first reads your .bashrc file to get the value of the Java environment variable and then executes the studio.sh script to run Android Studio using that value.

Here’s an example of that edited line:

Exec=bash -i "/<path-to-android-studio>/android-studio/bin/studio.sh" %f

If the Android Studio icon doesn’t appear in the Launcher:

  • run the studio.sh script in a terminal window to start Android Studio. Unity will pickup the values defined in the .desktop file
  • when the icon shows up in the Launcher, you can right-click on it and choose `Lock to Launcher’ as usual.
Answered By: Irving Moy

This has been asked before for IntelliJ. Since Android Studio is the same in this context I will link to the answer and copy it here.

https://askubuntu.com/a/272336/72597

Snippet from linked answer

[Old Answer]

Download IntelliJ IDEA CE from [www.jetbrains.com/idea/download/][3].

  1. Extract ideaIC-XX.Y.Z.tar.gz using

    tar -zxvf ideaIC-XX.Y.Z.tar.gz
    
  2. Become root.

    sudo -i
    
  3. Move the extracted folder to /opt/idea

    mv ideaIC-XX.Y.Z /opt/idea
    
  4. Create a desktop file and install it:

    gedit idea.desktop
    

    and copy the following to the idea.desktop file.

    [Desktop Entry]
    Name=IntelliJ IDEA 
    Type=Application
    Exec=idea.sh
    Terminal=false
    Icon=idea
    Comment=Integrated Development Environment
    NoDisplay=false
    Categories=Development;IDE;
    Name[en]=IntelliJ IDEA
    

    then execute the following command to automatically install it in the unity:

    desktop-file-install idea.desktop
    
  5. Create a symlink in /usr/local/bin using

    cd /usr/local/bin
    ln -s /opt/idea/bin/idea.sh
    
  6. For idea icon to be displayed in dash, idea icon can be added as

    cp /opt/idea/bin/idea.png /usr/share/pixmaps/idea.png
    

That’s it. Now, you can launch IntelliJ from Ubuntu dash.

Note that there is an updated version of this answer and I suspect that it might apply to android studio as well.

Answered By: Christophe De Troyer

This is so simple…

Go to Android Studio > Tools > Create desktop Entry

Answered By: Nandan Kumar Singh

Here is my android-studio.desktop file. Its working after adding bash -i before program path.

[Desktop Entry]
Version=1.0
Type=Application
Name=Android Studio
Exec=bash -i "/home/user/android-studio/bin/studio.sh" %f
Icon=/home/user/android-studio/bin/studio.png
Categories=Development;IDE;
Terminal=false
StartupNotify=true
StartupWMClass=jetbrains-android-studio
Name[en_GB]=android-studio.desktop
Answered By: Manura Nirmal Perera
[Desktop Entry]
Name=Android Studio
Icon=/home/android-studio/bin/studio.png //comment here any file this used for the display icon in desktop
Exec=/home/android-studio/bin/studio.sh
Type=Application

save this file in desktop folder (android-studio.desktop)

after save right click on this file properties option and set permission select ==>Execute in terminal emulator

Thank you!

Answered By: Hardik Vasani

If Tools->Create Desktop Entry doesn’t works for you then it probably means that the Android studio isn’t installed properly in the system.
To check whether the Android Studio is installed or not go to the Ubuntu software and find for the software.
If it doesn’t reinstall the package and take care of the path of the sdk and AndroidStudioProjects.
But it is possible that the desktop shortcut icon works properly.

Answered By: Deepak Kumar

For Android Studio version 3.6.3 the Create Desktop Entry option is not present under the Tools option.
Launch the application from the command prompt using:

/path/to/android-studio/bin./studio.sh

You can see the Configure drop-down menu in the bottom right corner. Under the Configure menu, there is an option for Create Desktop Entry. Click and create.

Answered By: Raj Rajeshwari Kayan