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 which I am doing wrong? I just want a simple launcher icon for Android Studio on my dash! I am using ubuntu 14.04

share|improve this question
    
Did you make the .desktop executable? sudo chmod +x ./file.desktop – Xweque Feb 25 '15 at 11:14
    
thid is not necessary and does not work for this issue – androidevil May 19 '15 at 6:57
    
This is so simple please follow the link – Nandan Kumar Singh Aug 6 '16 at 12:25
up vote 15 down vote accepted

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
share|improve this answer
    
Thanks. Adding bash -i in Exec solved the issue – jayant Dec 6 '15 at 6:37

This is so simple...

Go to Android Studio > Tools > Create desktop Entry

share|improve this answer
    
Shortcut appeared and worked in case of dash but no shortcut on desktop. – Napolean Jul 29 '16 at 6:27

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.
share|improve this answer

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.

share|improve this answer
1  
I now have the exact same file with all the right paths. It's still not working. Which ubuntu version are you using? Also, can you share what permissions are for the .desktop file? And did you add anything in your PATH env variable for this to work? – jayant Feb 25 '15 at 5:35
    
@jayant I created the file on editor, it got execute permission and using terminal as root I moved it into the /usr/share/applications directory. I have added this PATH=$PATH:/home/user-name/android-studio/bin/ to the end of ~/.bashrc file, thats for the command studio.sh in the terminal. Does your JAVA_HOME variable(echo $JAVA_HOME) gives proper result? – theDistantStar Feb 25 '15 at 8:26
    
I did not had JAVA_HOME set. But even after setting that to the correct path, the launcher is still not working. Are you using ubuntu 14.04? – jayant Feb 25 '15 at 8:52
    
Yes mine is 14.04. You may have already tried this, if not follow this steps and lets hope it works- 1. Delete all the .desktop file of android-studio you created/moved to the /usr/share/applications directory. 2. Remove jetbrains-android-studio.desktop in your ~/.local/share/applications. 3. RESTART computer 4. Make sure echo $JAVA_HOME prints, if not add the path to ~/.bashrc 5. Create the .desktop file using any text editor. 6. Give execute permission to file 7. Move the file to usr/share/applications as root 8. With all hopes click on the studio icon in usr/share/applications – theDistantStar Feb 25 '15 at 10:14
1  
Thanks for following through. Tried all the steps. Still not working. Can't find anything in the logs. It's really frustrating! – jayant Feb 25 '15 at 17:30

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 :).

share|improve this answer

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.

share|improve this answer
[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!

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.