Ubuntu 16.04 搭建Android开发环境

1、Installing Java

sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java8-installer

After that

  sudo apt-get install oracle-java8-set-default

2、Installing Android Studio

   (1) Download Android Studio from here or here,use All Android Studio Packages

  (2) Extract the archive file into an appropriate location for your applications, eg: /opt. Use the filename of your downloaded archive, in my example android-studio-ide-143.2739321-linux.zip

  sudo unzip android-studio-ide-141.2178183-linux.zip -d /opt

  (3) To launch Android Studio, navigate to the /opt/android-studio/bin directory in a terminal and execute ./studio.sh. Or use a desktop file, see below.

You may want to add /opt/android-studio/bin to your PATH environmental variable so that you can start Android Studio from any directory.

3、Create a desktop file 

  gedit ~/.local/share/applications/android-studio.desktop

and add the lines below

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

4、Installing Android SDK

  use Android SDK manager or download from here

5、Add adb PATH

  (1) sudo gedit ~/.bashrc

  add this to the file

  # Android SDK
  export ANDROID_SDK_HOME=<your sdk path>
  PATH=$PATH:$ANDROID_SDK_HOME/tools
  PATH=$PATH:$ANDROID_SDK_HOME/platform-tools

       and then

  source ~/.bashrc   

  (2) cd /usr/bin

  sudo ln -s <your adb path>

  (3) adb devices

  if you get like this:  

  List of devices attached
  0123456789ABCDEF no permissions

  then you should just try this:

  sudo adb kill-server

  and then 

  sudo adb start-server

  if you still get like this:

  List of devices attached
  0123456789ABCDEF unauthorized

  maybe you should open USB debug on your phone

 

参考资料:
1、http://androiddevtools.cn/

2、http://askubuntu.com/questions/634082/how-to-install-android-studio-on-ubuntu

3、http://stackoverflow.com/questions/9210152/set-up-device-for-development-no-permissions

4、Ubuntu 14.04 安装genymotion

posted @ 2016-04-17 01:14  Droi  阅读(8460)  评论(0编辑  收藏  举报