转载请注明出处: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.0Type=ApplicationName=Android StudioExec="/home/username/Programs/AndroidStudio/bin/studio.sh" %fIcon=/home/username/Programs/AndroidStudio/bin/idea.pngCategories=Development;IDE;Terminal=falseStartupNotify=trueStartupWMClass=jetbrains-android-studioName[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:

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

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

Ubuntu 14 配置Android Studio的快捷启动方式_第1张图片

做了这些之后就可以从桌上和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的图标也自动消失了。 Ubuntu 14 配置Android Studio的快捷启动方式_第2张图片
另外:如果打开了某个工程进入主界面的时候可以在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下提示未信任的应用启动器的问题

更多相关文章

  1. Android屏幕截图实现方式 系统截屏源码分析和三指截屏
  2. android用户界面之Notification教程实例汇总
  3. andorid 将布局文件(layout)转换为图片(Bitmap)简单使用详解
  4. 在Mac系统上配置Android真机调试环境
  5. 【Android】UI界面外的线程,控制刷新UI界面
  6. Android获取网络连接状态(3G/Wifi)及调用网络配置界面
  7. Android 存储字符串数据到txt文件

随机推荐

  1. Android Things:“1024工场”店铺开张啦!树
  2. 微信 Tinker 的一切都在这里,包括源码
  3. Android ListView监听上下滑动(判断是否
  4. Android本地数据存储之Sharedpreference
  5. Android Studio 出现 Gradle's dependenc
  6. Android基础入门教程——7.4 Android调用
  7. 如何删除android中的蓝色操作栏?
  8. 解决Android Studio下载更新Android SDK
  9. Android自定义View底部连续圆环效果
  10. Android中RecyclerView的item中控件的点