Linux中怎么搭建一個(gè)Android開發(fā)環(huán)境

Linux中怎么搭建一個(gè)Android開發(fā)環(huán)境,相信很多沒有經(jīng)驗(yàn)的人對(duì)此束手無策,為此本文總結(jié)了問題出現(xiàn)的原因和解決方法,通過這篇文章希望你能解決這個(gè)問題。

創(chuàng)新互聯(lián)長(zhǎng)期為上千余家客戶提供的網(wǎng)站建設(shè)服務(wù),團(tuán)隊(duì)從業(yè)經(jīng)驗(yàn)10年,關(guān)注不同地域、不同群體,并針對(duì)不同對(duì)象提供差異化的產(chǎn)品和服務(wù);打造開放共贏平臺(tái),與合作伙伴共同營(yíng)造健康的互聯(lián)網(wǎng)生態(tài)環(huán)境。為佛坪企業(yè)提供專業(yè)的成都網(wǎng)站制作、成都做網(wǎng)站,佛坪網(wǎng)站改版等技術(shù)服務(wù)。擁有十載豐富建站經(jīng)驗(yàn)和眾多成功案例,為您定制開發(fā)。

1、系統(tǒng)環(huán)境

[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、準(zhǔn)備軟件

java

eclipse

android-sdk

ADT

這些軟件都可以在官網(wǎng)上下載。

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 ~]$

通過命令查看當(dāng)前已經(jīng)安裝了java的相關(guān)jdk,可以進(jìn)行下一步。

(2)           安裝eclipse

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

[android@localhost Base Env]$ ls

ADT-18.0.0.zip

android-sdk_r18-linux.tgz

Android開發(fā)環(huán)境搭建(Linux篇).doc

eclipse

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

Linux環(huán)境搭建.doc

Linux 下Android 開發(fā)環(huán)境搭建 .doc

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

[android@localhost Base Env]$ ls

ADT-18.0.0.zip

android-sdk_r18-linux.tgz

Android開發(fā)環(huán)境搭建(Linux篇).doc

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

Linux環(huán)境搭建.doc

Linux 下Android 開發(fā)環(huán)境搭建 .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開發(fā)環(huán)境搭建(Linux篇).doc

eclipse

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

Linux環(huán)境搭建.doc

Linux 下Android 開發(fā)環(huán)境搭建 .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

啟動(dòng)eclipse之后,eclipse會(huì)自動(dòng)創(chuàng)建并尋找workspace文件夾,可以直接點(diǎn)擊ok按鈕即可。eclipse的啟動(dòng)過程如下圖所示:

Linux中怎么搭建一個(gè)Android開發(fā)環(huán)境

Linux中怎么搭建一個(gè)Android開發(fā)環(huán)境

eclipse也可以在gnome桌面下直接雙擊eclipse可執(zhí)行文件啟動(dòng)。

(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開發(fā)環(huán)境搭建(Linux篇).doc                                

eclipse                                                         

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

Linux環(huán)境搭建.doc                                               

Linux 下Android 開發(fā)環(huán)境搭建 .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模擬器的升級(jí)更新界面,如下圖所示:

接下來的操作主要是對(duì)該模擬器中的相關(guān)包進(jìn)行下載升級(jí),需要的時(shí)間可能會(huì)很長(zhǎng)(本人在進(jìn)行升級(jí)時(shí)基本上會(huì)在晚上保持開機(jī),因?yàn)锳ndroid系統(tǒng)之間得不兼容性。當(dāng)然,您如果只是針對(duì)某一個(gè)Android系統(tǒng)版本,那會(huì)快很多。不過在以后也可以追加下載安裝的。):

Linux中怎么搭建一個(gè)Android開發(fā)環(huán)境

Linux中怎么搭建一個(gè)Android開發(fā)環(huán)境

Linux中怎么搭建一個(gè)Android開發(fā)環(huán)境

您可以選擇Aceept all:


      點(diǎn)擊Install按鈕之后,您會(huì)跳轉(zhuǎn)到下面的界面中,其中,在該對(duì)話框的最下面,您會(huì)看到當(dāng)前包的下載速度與進(jìn)度:

Linux中怎么搭建一個(gè)Android開發(fā)環(huán)境
      AndroidSDK Manager有時(shí)候也會(huì)彈出下面的log對(duì)話框,這里面可以看到更加詳細(xì)的信息(您可以關(guān)閉該對(duì)話框。如果您下一次確實(shí)需要看,您可以點(diǎn)擊后色按鈕后面的那個(gè)按鈕,管理器會(huì)打開日志對(duì)話框):

Linux中怎么搭建一個(gè)Android開發(fā)環(huán)境

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

下載過程中,SDK Menager會(huì)彈出如下圖的站點(diǎn)認(rèn)證信息,可忽略該認(rèn)證:

Linux中怎么搭建一個(gè)Android開發(fā)環(huán)境

在下載安裝完成后,安卓SDK 管理器會(huì)彈出下面的對(duì)話框:

Linux中怎么搭建一個(gè)Android開發(fā)環(huán)境

此時(shí),您可以勾選標(biāo)注為Not installed的相關(guān)包,點(diǎn)擊Install*package可以安裝您選擇的沒有安裝的相關(guān)包,但此時(shí)安裝的包大都需要您給出站點(diǎn)認(rèn)證信息。相關(guān)信息截圖如下:

Linux中怎么搭建一個(gè)Android開發(fā)環(huán)境

Linux中怎么搭建一個(gè)Android開發(fā)環(huán)境

Linux中怎么搭建一個(gè)Android開發(fā)環(huán)境

  至此,Android SDK Manager安裝完畢。

 

(4)           安裝ADT插件

首先,您要啟動(dòng)eclipse;

在IDE中點(diǎn)擊Help->Install New Software...打開eclipse的Install對(duì)話框,如下圖所示:

Linux中怎么搭建一個(gè)Android開發(fā)環(huán)境
 

Linux中怎么搭建一個(gè)Android開發(fā)環(huán)境

  點(diǎn)擊Add...按鈕,打開Add Repository對(duì)話框:

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

Linux中怎么搭建一個(gè)Android開發(fā)環(huán)境
 

Linux中怎么搭建一個(gè)Android開發(fā)環(huán)境

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

在這里,直接點(diǎn)擊ok就可以了:

Linux中怎么搭建一個(gè)Android開發(fā)環(huán)境
      勾選Name中的Developer Tools,直接點(diǎn)擊Next,進(jìn)行安裝:

Linux中怎么搭建一個(gè)Android開發(fā)環(huán)境

Linux中怎么搭建一個(gè)Android開發(fā)環(huán)境

Linux中怎么搭建一個(gè)Android開發(fā)環(huán)境

  這時(shí),就需要接受協(xié)議條款了,接下來直接點(diǎn)擊Finish按鈕:

Linux中怎么搭建一個(gè)Android開發(fā)環(huán)境
      在安裝界面,您可以點(diǎn)擊Details>>按鈕查看當(dāng)前的詳細(xì)信息,此時(shí)在Eclipse的IDE界面的右下角也會(huì)給出進(jìn)度提示:

Linux中怎么搭建一個(gè)Android開發(fā)環(huán)境
      插件安裝過程中,可能會(huì)彈出來下面的警告信息,看完消息之后,您會(huì)和我一樣點(diǎn)擊確定按鈕的:

Linux中怎么搭建一個(gè)Android開發(fā)環(huán)境

    安裝完成后,Eclipse會(huì)讓您選擇是否重啟Eclipse來應(yīng)用您剛剛給IDE帶來的新變化,這就因時(shí)而異了:

Linux中怎么搭建一個(gè)Android開發(fā)環(huán)境

    重啟進(jìn)入Eclipse之后,一般情況下,會(huì)彈出Welcome to Android Development的對(duì)話框:

Linux中怎么搭建一個(gè)Android開發(fā)環(huán)境

    如果沒有彈出該對(duì)話框,可以在Window->Perferences中的Android進(jìn)行必要的設(shè)置,

    該設(shè)置項(xiàng)位于SDK Location下。

     這里需要設(shè)置的是Target Location,您可一點(diǎn)擊Browse...來瀏覽選擇您之前安裝的Android-sdk-linux的路徑地址:

Linux中怎么搭建一個(gè)Android開發(fā)環(huán)境
點(diǎn)擊確定即可:

接下來,就是簡(jiǎn)單的Next:

Linux中怎么搭建一個(gè)Android開發(fā)環(huán)境

Linux中怎么搭建一個(gè)Android開發(fā)環(huán)境

接下來需要選擇可安裝的包,一般點(diǎn)擊Accept All:

Linux中怎么搭建一個(gè)Android開發(fā)環(huán)境

Linux中怎么搭建一個(gè)Android開發(fā)環(huán)境

  這一過程安裝完成之后,可以通過Eclipse中的Window->AVD Manager打開Android Virtual Device Manager。也可一通過tools下的android bash文件打開,不過可能稍微有一點(diǎn)困難,應(yīng)該是不建議的打開方式。

設(shè)置創(chuàng)維M6的平板”驅(qū)動(dòng)”

(請(qǐng)?jiān)试S這么稱呼,只是因?yàn)轭愃婆cWindows下的驅(qū)動(dòng)效果,如此設(shè)置后,既可以打開創(chuàng)維M6的adb使用)

1、使用lsusb命令查看系統(tǒng)的USB設(shè)備:

[android@bogon ~]$ lsusb

Bus 002 Device 005: ID 0bb4:0c02 High Tech ComputerCorp. Dream / ADP1 / G1 Phone (Debug)                                                                       

Bus 002 Device 003: ID 093a:2510 Pixart Imaging,Inc. Optical Mouse            

Bus 002 Device 002: ID 8087:0020 Intel Corp.Integrated Rate Matching Hub      

Bus 002 Device 001: ID 1d6b:0002 Linux Foundation2.0 root hub                  

Bus 001 Device 002: ID 8087:0020 Intel Corp.Integrated Rate Matching Hub      

Bus 001 Device 001: ID 1d6b:0002 Linux Foundation2.0 root hub                 

[android@bogon ~]$

由此可以看出,進(jìn)入Debug模式下的0bb4是創(chuàng)維M6的ID。

2、切換之a(chǎn)ndroid-sdk-linux的tools目錄下,更新adb:                                   

[android@bogon tools]$ ./androidupdate adb

adb has been updated. You must restart adb with thefollowing commands

  adbkill-server                                               

  adbstart-server

[android@bogon tools]$

3、嘗試查看Android設(shè)備:                                                                                          

[android@bogon platform-tools]$ ./adb devices                         

* daemon not running. starting it now on port 5037*                 

* daemon started successfully *                                      

List of devices attached                                             

????????????   no permissions                                        

[android@bogon platform-tools]$

可以看出,該命令執(zhí)行失敗,返回的結(jié)果,本人不知。

4、加入創(chuàng)維M6的ID到adb_usb.ini文件下(必須擁有root權(quán)限,并且該文件存在于隱藏的.android文件夾下):

[android@bogon ~]$ suroot             

密碼:                                 

[root@bogon android]# ls-al            

總用量 200                             

drwx------. 34 android android 4096  4月 13 09:10 .

drwxr-xr-x. 5 root    root    4096 4月 13 08:57 ..

drwx------. 3 android android 4096  4月 13 09:01 .adobe

drwxrwxr-x. 3 android android 4096  4月 13 09:18 .android

drwxrwxr-x. 4 android android 4096  4月 13 09:13 Base Env

-rw-r--r--. 1 android android   18  6月 22 2010 .bash_logout

-rw-r--r--. 1 android android  176  6月 22 2010 .bash_profile

-rw-r--r--. 1 android android  124  6月 22 2010 .bashrc     

drwxr-xr-x. 3 android android 4096  4月 13 08:58 .cache      

drwxr-xr-x. 6 android android 4096  4月 13 09:13 .config    

drwx------. 3 android android 4096  4月 13 08:58 .dbus      

-rw-r--r--. 1 android android  500  1月 24 2007 .emacs      

-rw-------. 1 android android   16  4月 13 08:58 .esd_auth  

drwx------. 4 android android 4096  4月 13 08:59 .gconf     

drwx------. 2 android android 4096  4月 13 09:09 .gconfd    

drwxr-xr-x. 7 android android 4096  4月 13 09:07 .gnome2    

drwx------. 2 android android 4096  4月 13 08:58 .gnome2_private

drwxrwxr-x. 3 android android 4096  4月 13 08:58 .gnote        

drwx------. 2 android android 4096  4月 13 08:58 .gnupg        

drwxrwxr-x. 2 android android 4096  4月 13 08:58 .gstreamer-0.10

-rw-rw-r--. 1 android android  200  4月 13 08:58 .gtk-bookmarks

drwx------. 2 android android 4096  4月 13 08:58 .gvfs         

-rw-------. 1 android android  310  4月 13 08:58 .ICEauthority 

-rw-r--r--. 1 android android  794  4月 13 08:58 .imsettings.log

drwx------. 3 android android 4096  4月 13 09:09 .kde          

-rw-r--r--. 1 android android  121  6月 29 2010 .kshrc         

drwxr-xr-x. 3 android android 4096  4月 13 08:58 .local        

drwx------. 3 android android 4096  4月 13 09:01 .macromedia   

-rw-r--r--. 1 android android  124  6月 25 2010 .mkshrc         

drwxr-xr-x. 5 android android 4096  4月 13 08:58 .mozilla      

drwxr-xr-x. 2 android android 4096  4月 13 08:58 .nautilus     

drwx------. 2 android android 4096  4月 13 08:58 .pulse        

-rw-------. 1 android android  256  4月 13 08:58 .pulse-cookie 

-rw-------. 1 android android  218  4月 13 09:07 .recently-used.xbel

drwxrwxr-x. 3 android android 4096  4月 13 08:58 .redhat           

drwx------. 2 android android 4096  4月 13 08:58 .ssh              

drwx------. 3 android android 4096  4月 13 09:10 .thumbnails       

drwxrwxr-x. 3 android android 4096  4月 13 09:10 workspace         

-rw-------. 1 android android   50  4月 13 08:57 .xauthoxIGCv      

-rw-------. 1 android android 4401  4月 13 09:26 .xsession-errors  

-rw-r--r--. 1 android android  658 12月  9 2009 .zshrc             

drwxr-xr-x. 2 android android 4096  4月 13 08:58 公共的            

drwxr-xr-x. 2 android android 4096  4月 13 08:58 模板              

drwxr-xr-x. 2 android android 4096  4月 13 08:58 視頻              

drwxr-xr-x. 2 android android 4096  4月 13 08:58 圖片              

drwxr-xr-x. 2 android android 4096  4月 13 08:58 文檔              

drwxr-xr-x. 2 android android 4096  4月 13 09:13 下載              

drwxr-xr-x. 2 android android 4096  4月 13 08:58 音樂               

drwxr-xr-x. 2 android android 4096  4月 13 08:58 桌面                                           

[root@bogon android]# cd.android/

[root@bogon .android]# ls        

adb_usb.ini avd                 

[root@bogon .android]# vimadb_usb.ini

[root@bogon .android]# lsusb          

Bus 002 Device 008: ID 0bb4:0c02 High Tech ComputerCorp. Dream / ADP1 / G1 Phone (Debug)                                                                      

Bus 002 Device 003: ID 093a:2510 Pixart Imaging,Inc. Optical Mouse             

Bus 002 Device 002: ID 8087:0020 Intel Corp.Integrated Rate Matching Hub      

Bus 002 Device 001: ID 1d6b:0002 Linux Foundation2.0 root hub                 

Bus 001 Device 002: ID 8087:0020 Intel Corp.Integrated Rate Matching Hub      

Bus 001 Device 001: ID 1d6b:0002 Linux Foundation2.0 root hub                 

[root@bogon .android]# gvimadb_usb.ini

# ANDROID 3RD PARTY USBVENDOR ID LIST – DO NOT EDIT.

# USE 'android updateadb' TO GENERATE

# 1 USB VENDOR ID PERLINE.'

0x0bb4#該段的前面的內(nèi)容為該文件原來保存的內(nèi)容,只需在最后添加創(chuàng)維M6的ID即可。

5、以root權(quán)限創(chuàng)建文件/etc/udev/rules.d/im-android.rules文件,并在其中添加下面紅色加粗的文字,其中的含義,您可以猜得懂。記得給該文件賦予可讀可執(zhí)行權(quán)限。

[root@bogon .android]# cd..                                                   

[root@bogon android]# cd..                                                    

[root@bogon home]# gvim/etc/udev/rules.d/imx-android.rules

SUBSYSTEM==”usb”,SYSFS{idVendor}==”0bb4”,MODE=”0666”

[root@bogon home]# gvim/etc/bash.bashrc                  

[root@bogon home]# exit                                   

exit                                                      

[android@bogon ~]$ cdBase\ Env/                                                         

[android@bogon Base Env]$ ls

ADT-18.0.0.zip             eclipse

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

android-sdk_r18-linux.tgz                                                   

[android@bogon Base Env]$ cd android-sdk-linux/

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

add-ons docs  platforms  platform-tools  SDK Readme.txt  temp tools                             

[android@bogon android-sdk-linux]$ cd platform-tools/               

[android@bogon platform-tools]$ ./adb devices                       

List of devices attached                                            

????????????   no permissions                                      

[android@bogon platform-tools]$ ./adb kill-server

[android@bogon platform-tools]$ ./adb start-server

* daemon not running. starting it now on port 5037*

* daemon started successfully *                    

[android@bogon platform-tools]$ ./adb devices      

List of devices attached                           

????????????   no permissions                     

[android@bogon platform-tools]$ cd /etc/udev/rules.d

[android@bogon rules.d]$ ll                        

總用量 76                                          

-rw-r--r--. 1 root root 6627  6月 24 2010 40-hplip.rules

-rw-r--r--. 1 root root  226  8月 18 2010 51-dlm.rules 

-rw-r--r--. 1 root root  495  6月 24 2010 56-hpmud_support.rules

-rw-r--r--. 1 root root 1652  8月 26 201060-fprint-autosuspend.rules

-rw-r--r--. 1 root root 1060  6月 29 2010 60-pcmcia.rules           

-rw-r--r--. 1 root root  452  8月 13 2010 60-raw.rules              

-rw-r--r--. 1 root root  292  7月 17 2010 70-cups-libusb.rules      

-rw-r--r--. 1 root root  788  2月 21 02:41 70-persistent-cd.rules   

-rw-r--r--. 1 root root  460  2月 21 01:49 70-persistent-net.rules  

-rw-r--r--. 1 root root 1914  1月 13 2010 85-pcscd_ccid.rules       

-rw-r--r--. 1 root root  320  5月 15 2009 90-alsa.rules             

-rw-r--r--. 1 root root   83  7月 28 2010 90-hal.rules              

-rw-r--r--. 1 root root  359  8月 18 2010 90-rdma.rules             

-rw-r--r--. 1 root root   53  4月 19 2010 91-drm-modeset.rules      

-rw-r--r--. 1 root root 2486  6月 30 201097-bluetooth-serial.rules 

-rw-r--r--. 1 root root  292  8月 30 2010 98-kexec.rules            

-rw-r--r--. 1 root root   54  4月  9 2010 99-fuse.rules              

-rw-r--r--. 1 root root   53  4月 13 09:39 imx-android.rules                                    

[android@bogon rules.d]$ su root

密碼:                         

[root@bogon rules.d]# chmod+rx imx-android.rules

[root@bogon rules.d]# ll                         

總用量 76                                        

-rw-r--r--. 1 root root 6627  6月 24 2010 40-hplip.rules

-rw-r--r--. 1 root root  226  8月 18 2010 51-dlm.rules 

-rw-r--r--. 1 root root  495  6月 24 2010 56-hpmud_support.rules

-rw-r--r--. 1 root root 1652  8月 26 201060-fprint-autosuspend.rules

-rw-r--r--. 1 root root 1060  6月 29 2010 60-pcmcia.rules

-rw-r--r--. 1 root root  452  8月 13 2010 60-raw.rules

-rw-r--r--. 1 root root  292  7月 17 2010 70-cups-libusb.rules

-rw-r--r--. 1 root root  788  2月 21 02:41 70-persistent-cd.rules

-rw-r--r--. 1 root root  460  2月 21 01:49 70-persistent-net.rules

-rw-r--r--. 1 root root 1914  1月 13 2010 85-pcscd_ccid.rules

-rw-r--r--. 1 root root  320  5月 15 2009 90-alsa.rules

-rw-r--r--. 1 root root   83  7月 28 2010 90-hal.rules

-rw-r--r--. 1 root root  359  8月 18 2010 90-rdma.rules

-rw-r--r--. 1 root root   53  4月 19 2010 91-drm-modeset.rules

-rw-r--r--. 1 root root 2486  6月 30 2010 97-bluetooth-serial.rules

-rw-r--r--. 1 root root  292  8月 30 2010 98-kexec.rules

-rw-r--r--. 1 root root   54  4月  9 2010 99-fuse.rules

-rwxr-xr-x. 1 root root   53  4月 13 09:39 imx-android.rules

[root@bogon rules.d]#

6、啟動(dòng)/etc/init.d/udev-post服務(wù):

[root@bogon rules.d]# /etc/init.d/udevrestart

bash: /etc/init.d/udev: 沒有那個(gè)文件或目錄

[root@bogon rules.d]# cd/etc/init.d/

[root@bogon init.d]# ls| grep udev

udev-post

[root@bogon init.d]# /etc/init.d/udev-postrestart

用法:/etc/init.d/udev-post {start|stop|reload}

[root@bogon init.d]# /etc/init.d/udev-postreload

重新激發(fā)失敗的 udev 事件                                   [確定]

[root@bogon init.d]# /etc/init.d/udev-poststart

重新激發(fā)失敗的 udev 事件                                   [確定]

[root@bogon init.d]# cd/home/android/Base\ Env/android-sdk-linux/platform-tools/

[root@bogon platform-tools]# ./adb kill-server

[root@bogon platform-tools]# ./adb devices

* daemon not running. starting it now on port 5037*

* daemon started successfully *

List of devices attached

0123456789ABCDEF        device

[root@bogon platform-tools]#

[root@bogon platform-tools]# ./adb shell

# pwd

/

# ls

config

cache

udisk

flash

sdcard

acct

mnt

vendor

d

etc

ueventd.rk29board.rc

ueventd.rc

ueventd.goldfish.rc

system

sys

sbin

proc

init_battery.sh

init.rk29board.rc

init.rc

init.goldfish.rc

init

default.prop

data

root

dev

# exit

[root@bogon platform-tools]#

7、為了能夠向其他的bash命令一樣運(yùn)行adb,即不許要在前面添加”./”,您需要修改相應(yīng)的環(huán)境變量配置文件,您可以如下進(jìn)行您的操作:

[root@bogon platform-tools]# vim /etc/profile

…

export Android_HOME=/home/android/Base\Env/android-sdk-linux

export PATH=$PATH:$Android_HOME/platform-tools

[root@bogon platform-tools]# source /etc/profile

[root@bogon platform-tools]# exit

[android@bogon ~]$

[android@bogon ~]$ echo$PATH

/usr/lib/qt-3.3/bin:/usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin:/home/android/bin

為了讓您設(shè)置的環(huán)境變量剩下,可以對(duì)該文件source一下,如下:                        

[android@bogon ~]$ source/etc/profile

[android@bogon ~]$ echo$PATH        

/usr/lib/qt-3.3/bin:/usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin:/home/android/bin:/home/android/BaseEnv/android-sdk-linux/platform-tools

[android@bogon ~]$ adbdevices

List of devices attached

0123456789ABCDEF        device

[android@bogon ~]$ adbshell

# pwd

/

# ./data/grip/ids

1. wlan0

(no description available)

2. any

(Pseudo-device that captures on all interfaces)

3. lo

(no description available)

input a interface:(1-3)1

dev:wlan0

----ethernet protocol(phydical layer)-----

MAC source Address:

78:d6:f0:25:af:a9

MAC destination Address:

00:26:9e:6f:cc:e3

protocol:0806

this is a ARP protocol

------ARP Protocol-------

----ethernet protocol(phydical layer)-----

MAC source Address:

00:26:9e:6f:cc:e3

MAC destination Address:

78:d6:f0:25:af:a9

protocol:0806

this is a ARP protocol

------ARP Protocol-------

^C

# [android@bogon ~]$

[android@bogon ~]$

看完上述內(nèi)容,你們掌握Linux中怎么搭建一個(gè)Android開發(fā)環(huán)境的方法了嗎?如果還想學(xué)到更多技能或想了解更多相關(guān)內(nèi)容,歡迎關(guān)注創(chuàng)新互聯(lián)行業(yè)資訊頻道,感謝各位的閱讀!

文章名稱:Linux中怎么搭建一個(gè)Android開發(fā)環(huán)境
本文來源:http://muchs.cn/article14/jojoge.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供定制開發(fā)、小程序開發(fā)、標(biāo)簽優(yōu)化動(dòng)態(tài)網(wǎng)站、外貿(mào)網(wǎng)站建設(shè)、域名注冊(cè)

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來源: 創(chuàng)新互聯(lián)

小程序開發(fā)