歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Linux基礎 >> Linux服務器 >> Linux下Android開發環境搭建詳細步驟

Linux下Android開發環境搭建詳細步驟

日期:2017/3/2 16:28:49   编辑:Linux服務器

  1、系統環境

  [android@localhost ~]$ uname -a

  Linux localhost.localdomain 2.6.32-71.el6.i686 #1SMP Wed Sep 1 01:26:34 EDT 2010 i686 i686 i386 GNU/Linux

  [android@localhost ~]$ lsb_release -a

  LSB Version: :core-4.0-ia32:core-4.0-noarch:graphics-4.0-ia32:graphics-4.0-noarch:printing-4.0-ia32:printing-4.0-noarch

  Distributor ID: RedHatEnterpriseServer

  Description: Red Hat Enterprise Linux Server release 6.0 (Santiago)

  Release: 6.0

  Codename: Santiago

  [android@localhost ~]$

  2、准備軟件

  java

  eclipse

  android-sdk

  ADT

  這些軟件都可以在官網上下載。

  3、搭建過程

  (1) 安裝java

  [android@localhost ~]$ rpm -qa | grep java

  eclipse-mylyn-java-3.3.2-4.5.el6.i686

  java-1.6.0-openjdk-devel-1.6.0.0-1.21.b17.el6.i686

  java-1.6.0-openjdk-1.6.0.0-1.21.b17.el6.i686

  tzdata-java-2010l-1.el6.noarch

  gcc-java-4.4.4-13.el6.i686

  java-1.5.0-gcj-1.5.0.0-29.1.el6.i686

  subversion-javahl-1.6.11-2.el6.i686

  ooobasis3.3-javafilter-3.3.0-9567.i586

  libvirt-java-0.4.5-2.el6.noarch

  lpg-java-compat-1.1.0-4.1.el6.noarch

  libvirt-java-devel-0.4.5-2.el6.noarch

  mysql-connector-java-5.1.12-2.el6.i686

  ant-javamail-1.7.1-13.el6.i686

  java-1.6.0-openjdk-javadoc-1.6.0.0-1.21.b17.el6.i686

  java_cup-0.10k-5.el6.i686

  [android@localhost ~]$

  通過命令查看當前已經安裝了java的相關jdk,可以進行下一步。

  (2) 安裝eclipse

  從官網上下載的eclipse不需要按裝,直接解壓即可使用。如:

  [android@localhost Base Env]$ ls

  ADT-18.0.0.zip

  android-sdk_r18-linux.tgz

  Android開發環境搭建(Linux篇).doc

  eclipse

  eclipse-cpp-indigo-SR2-incubation-linux-gtk.tar.gz

  Linux環境搭建.doc

  Linux 下Android 開發環境搭建 .doc

  [android@localhost Base Env]$ rm -R eclipse

  [android@localhost Base Env]$ ls

  ADT-18.0.0.zip

  android-sdk_r18-linux.tgz

  Android開發環境搭建(Linux篇).doc

  eclipse-cpp-indigo-SR2-incubation-linux-gtk.tar.gz

  Linux環境搭建.doc

  Linux 下Android 開發環境搭建 .doc

  [android@localhost Base Env]$ tar -zxfeclipse-cpp-indigo-SR2-incubation-linux-gtk.tar.gz

  [android@localhost Base Env]$ ls

  ADT-18.0.0.zip

  android-sdk_r18-linux.tgz

  Android開發環境搭建(Linux篇).doc

  eclipse

  eclipse-cpp-indigo-SR2-incubation-linux-gtk.tar.gz

  Linux環境搭建.doc

  Linux 下Android 開發環境搭建 .doc

  [android@localhost Base Env]$ cd eclipse

  [android@localhost eclipse]$ ls

  about_files configuration eclipse.ini icon.xpm p2

  about.html dropins epl-v10.html libcairo-swt.so plugins

  artifacts.xml eclipse features notice.html readme

  [android@localhost eclipse]$ ll

  總用量 540

  drwxrwxr-x. 2 android android 4096 2月 17 03:06 about_files

  -rw-rw-r--. 1 android android 18909 2月 8 21:55 about.html

  -rw-rw-r--. 1 android android 88246 2月 17 03:06 artifacts.xml

  drwxrwxr-x. 5 android android 4096 2月 17 03:06 configuration

  drwxrwxr-x. 2 android android 4096 2月 17 03:06 dropins

  -rwxr-xr-x. 1 android android 62814 2月 8 22:16 eclipse

  -rw-rw-r--. 1 android android 407 2月 17 03:06 eclipse.ini

  -rw-rw-r--. 1 android android 16536 2月 8 21:36 epl-v10.html

  drwxrwxr-x. 46 android android 4096 2月 17 03:06 features

  -rw-rw-r--. 1 android android 9022 2月 8 21:54 icon.xpm

  -rwxr-xr-x. 1 android android 266168 2月 8 21:54 libcairo-swt.so

  -rw-rw-r--. 1 android android 8951 2月 8 21:36 notice.html

  drwxrwxr-x. 5 android android 4096 2月 17 03:05 p2

  drwxrwxr-x. 10 android android 36864 2月 17 03:06 plugins

  drwxrwxr-x. 2 android android 4096 2月 17 03:06 readme

  [android@localhost eclipse]$ ./eclipse

  啟動eclipse之後,eclipse會自動創建並尋找workspace文件夾,可以直接點擊ok按鈕即可。eclipse的啟動過程如下圖所示:

Linux下Android開發環境搭建詳細步驟
Linux下Android開發環境搭建詳細步驟

  eclipse也可以在gnome桌面下直接雙擊eclipse可執行文件啟動。

  (3) 安裝android-sdk

  [android@localhost Base Env]$ tar -zxfandroid-sdk_r18-linux.tgz

  [android@localhost Base Env]$ ls

  ADT-18.0.0.zip

  android-sdk-linux

  android-sdk_r18-linux.tgz

  Android開發環境搭建(Linux篇).doc

  eclipse

  eclipse-cpp-indigo-SR2-incubation-linux-gtk.tar.gz

  Linux環境搭建.doc

  Linux 下Android 開發環境搭建 .doc

  [android@localhost Base Env]$ cdandroid-sdk-linux/

  [android@localhost android-sdk-linux]$ ls

  add-ons platforms SDK Readme.txt tools

  [android@localhost android-sdk-linux]$ cd tools/

  [android@localhost tools]$ ll

  總用量 6772

  -rw-rw----. 1 android android 323 3月 30 23:20 adb_has_moved.txt

  -rwxrwx---. 1 android android 3491 3月 30 23:19 android

  drwxrwx---. 2 android android 4096 3月 30 23:19 ant

  -rwxrwx---. 1 android android 1977 3月 30 23:19 apkbuilder

  drwxrwx---. 3 android android 4096 3月 30 23:19 apps

  -rwxrwx---. 1 android android 3116 3月 30 23:19 ddms

  -rwxrwx---. 1 android android 46724 3月 30 23:19 dmtracedump

  -rwxrwx---. 1 android android 1940 3月 30 23:19 draw9patch

  -rwxrwx---. 1 android android 24828 3月 30 23:19 emulator

  -rwxrwx---. 1 android android 2814128 3月 30 23:19 emulator-arm

  -rwxrwx---. 1 android android 2765428 3月 30 23:19 emulator-x86

  -rwxrwx---. 1 android android 136860 3月 30 23:19 etc1tool

  -rwxrwx---. 1 android android 3282 3月 30 23:19 hierarchyviewer

  -rwxrwx---. 1 android android 9680 3月 30 23:19 hprof-conv

  drwxrwx---. 6 android android 4096 3月 30 23:19 lib

  -rwxrwx---. 1 android android 2015 3月 30 23:19 lint

  -rwxrwx---. 1 android android 9676 3月 30 23:19 mksdcard

  -rwxrwx---. 1 android android 3169 3月 30 23:19 monkeyrunner

  -rw-rw----. 1 android android 379587 3月 30 23:20 NOTICE.txt

  drwxrwx---. 7 android android 4096 3月 30 23:19 proguard

  -rw-rw----. 1 android android 66 3月 30 23:19 source.properties

  -rwxrwx---. 1 android android 613856 3月 30 23:19 sqlite3

  drwxrwx---. 2 android android 4096 3月 30 23:19 support

  -rwxrwx---. 1 android android 3044 3月 30 23:19 traceview

  -rwxrwx---. 1 android android 46784 3月 30 23:19 zipalign

  [android@localhost tools]$ ./android update sdk

  此處即打開了android模擬器的升級更新界面,如下圖所示:

  接下來的操作主要是對該模擬器中的相關包進行下載升級,需要的時間可能會很長(本人在進行升級時基本上會在晚上保持開機,因為Android系統之間得不兼容性。當然,您如果只是針對某一個Android系統版本,那會快很多。不過在以後也可以追加下載安裝的。):

Linux下Android開發環境搭建詳細步驟
Linux下Android開發環境搭建詳細步驟
Linux下Android開發環境搭建詳細步驟

  您可以選擇Aceept all:

  點擊Install按鈕之後,您會跳轉到下面的界面中,其中,在該對話框的最下面,您會看到當前包的下載速度與進度:

Linux下Android開發環境搭建詳細步驟

  AndroidSDK Manager有時候也會彈出下面的log對話框,這裡面可以看到更加詳細的信息(您可以關閉該對話框。如果您下一次確實需要看,您可以點擊後色按鈕後面的那個按鈕,管理器會打開日志對話框):

Linux下Android開發環境搭建詳細步驟

  在android-sdk安裝成功之後,在該目錄下,Android SDK Manager會創建platform-tools文件夾,該文件夾中包含了您已定會用到的adb等android命令。

  下載過程中,SDK Menager會彈出如下圖的站點認證信息,可忽略該認證:

Linux下Android開發環境搭建詳細步驟

  在下載安裝完成後,安卓SDK 管理器會彈出下面的對話框:

Linux下Android開發環境搭建詳細步驟

  此時,您可以勾選標注為Not installed的相關包,點擊Install*package可以安裝您選擇的沒有安裝的相關包,但此時安裝的包大都需要您給出站點認證信息。相關信息截圖如下:

Linux下Android開發環境搭建詳細步驟
Linux下Android開發環境搭建詳細步驟
Linux下Android開發環境搭建詳細步驟

  至此,Android SDK Manager安裝完畢。

  (4) 安裝ADT插件

  首先,您要啟動eclipse;

  在IDE中點擊Help->Install New Software...打開eclipse的Install對話框,如下圖所示:

Linux下Android開發環境搭建詳細步驟
Linux下Android開發環境搭建詳細步驟

  點擊Add...按鈕,打開Add Repository對話框:

  在這一步周中,您可一在Location輸入框中填入您下載ADT的URL。但此時,為了提高安裝速度,可以先將ADT下載到本地,然後點擊Archive...按鈕:

Linux下Android開發環境搭建詳細步驟
Linux下Android開發環境搭建詳細步驟

  這時,需要選擇您剛才下載的ADT(記得,一定不要解壓):

  在這裡,直接點擊ok就可以了:

Linux下Android開發環境搭建詳細步驟

12下一頁
Copyright © Linux教程網 All Rights Reserved