Ubuntu 14 配置Android Studio的快捷启动方式 - Go语言中文社区

Ubuntu 14 配置Android Studio的快捷启动方式


转载请注明出处:http://blog.csdn.net/aaa111/article/details/41833179

在window7下安装配置了Android Studio之后就想把ubuntu下的Android Studio整舒服。

桌面图标

Ubuntu下解压Android Studio压缩包后有个名为"Install-Linux-tar.txt"的说明文件,里面有这么一段:

  1. Unpack the Android Studio distribution archive that you downloaded to
    where you wish to install the program. We will refer to this destination
    location as your {installation home} below.

  2. Open a console and cd into "{installation home}/bin" and type:

    ./studio.sh

    to start the application.

  3. [OPTIONAL] Add the "{installation home}/bin" to your PATH environmental
    variable so that you may start Android Studio from any directory.

如果只做前两步的话每次启动Android Studio都要用终端进入Android Studio的文件夹运行"./studio.sh",这是很麻烦的。

第一次和第二次都是不正解。不想看请跳过。


第一次:修改/etc/profile文件,添加"{installation home}/bin"到环境变量。重启系统使其生效。

事实证明不作死就不会死啊...重启以后被卡在了输密码登陆的界面,无限循环输密码吗进不去系统。

解决办法:1.Ctrl+Alt+F1进入命令界面, 2.输入sudo vi /etc/profile还原为修改前的内容, 3.输入:wq保存, 4.输入reboot重启系统[1]。


第二次:修改/etc/environment添加"{installation home}/bin" 到PATH环境变量,此时可以从任意文件夹启动Android Studio了,但是还是要在终端里面。

顺便profile和environment的区别:系统是先执行/etc/environment,后执行/etc/profile。/etc/environment是设置整个系统的环境,而/etc/profile是设置所有用户的环境。系统应用程序的执行与用户环境可以是无关的,但与系统环境是相关的[2]。


正解在这里!

Google到一篇名为How to add Android Studio to the launcher?的文章[3],里面有一段Answers内容为:

Here is my AndroidStudio .desktop file which works from the launcher.

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

Alternatively, you can also open Android Studio, click on Configure(如果已经打开了AS,此处就改为Tools) -> Create Desktop Entry. This should create an entry on the dash:

screenshoot

------------------------

AndroidStudio.desktop文件放桌面上,就是下面这样子。


做了这些之后就可以从桌上和dash里启动Android Studio了。

如果提示未信任的应用启动器的问题,这时只要右键该应用的desktop文件,单击属性,在权限选项卡中勾选“允许作为程序执行文件”即可[4]。


锁定到Launcher

如果你并不需要桌面图标的话,下面这种方式可以更快捷的把AS图标锁定在Launcher上。
在第一次打开AS的欢迎界面的时候,按照下图在configure里点下Create Desktop Entry,此时在Launcher上的AS图标右键Lock to Launcher,就可以把AS的快捷方式锁定在这。
为什么要执行一下Create Desktop Entry呢?因为不执行这一步的话,虽然也有Lock to Launcher这个选项,但是有可能并没有成功锁定在Launcher上,退出AS后Launcher的图标也自动消失了。

另外:如果打开了某个工程进入主界面的时候可以在Tools的下拉菜单里找到Create Desktop Entry选项。


参考:

  1. Ubuntu 14.04解决登录界面无限循环的方法
  2. linux中/etc/profile 与/etc/environment文件的区别
  3. How to add Android Studio to the launcher?
  4. 解决ubuntu下提示未信任的应用启动器的问题
版权声明:本文来源CSDN,感谢博主原创文章,遵循 CC 4.0 by-sa 版权协议,转载请附上原文出处链接和本声明。
原文链接:https://blog.csdn.net/aaa111/article/details/41833179
站方申明:本站部分内容来自社区用户分享,若涉及侵权,请联系站方删除。
  • 发表于 2020-06-27 22:10:44
  • 阅读 ( 686 )
  • 分类:

0 条评论

请先 登录 后评论

官方社群

GO教程

猜你喜欢