在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文件放桌面上,就是下面这样子。


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

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

参考:

  1. Ubuntu 14.04解决登录界面无限循环的方法
  2. linux中/etc/profile 与/etc/environment文件的区别
  3. How to add Android Studio to the launcher?
  4. 解决ubuntu下提示未信任的应用启动器的问题

更多相关文章

  1. Android(安卓)8.0 添加一个可以让phone进程访问的hal service需
  2. android 广播 service
  3. 工作笔记-code
  4. [Android(安卓)Studio]添加选项菜单
  5. 解决 Linux/Ubuntu: adb shell insufficient permissions for dev
  6. Android系统的开机画面显示过程分析(7)
  7. Android中FTP上传、下载(含进度)
  8. mac下eclipse 搭建 maven开发环境
  9. Android(安卓)系统原生dialog使用

随机推荐

  1. Android使用XML全攻略
  2. android上使用XML
  3. android强大的SpannableStringBuilder
  4. Android解析XML(PULL)展示到ListView
  5. android与C++的选择
  6. 安装Android的SDK--中文教程(完整版,包括Ec
  7. Android指纹解锁调用
  8. android 中Message、Handler、Message Qu
  9. Android用户版本分布更新 2.1版领先
  10. Android热补丁动态修复技术(完结篇):自动