android命令實戰手冊

 

1            android.bat· 2

1.1      查看幫助信息: 2

1.2      創建avd· 2

1.3      Lists existing targets or virtual devices 2

1.4      Lists existing Android Virtual Devices 3

1.5      Lists existing targets 4

2            emulator.exe·· 5

2.1      啓動模擬器··· 5

2.2      使用模擬器控制檯··· 7

3            ddms.bat· 10

3.1      直接啓動ddms 10

4            adb·· 11

4.1      Adb help: 11

4.2      scripting: 13

4.3      device commands: 14

5            關於編譯···· 17

5.1      am: 18

5.2      重新編譯源碼··· 18

6            系統信息···· 18

6.1      Process: list process after phone started· 19

6.2      Memory info: list memory information after phone started· 19

6.3      Init log: list phone init log· 19

6.4      Bugreport: from adb bugreport· 19


 

1     android.bat

 

1.1   查看幫助信息:

    android.bat –h 或 android.bat –help

 

1.2   創建avd

(1)  android.bat create avd -t 1 -c 256M -p

E:/android_sdk/android-sdk-windows-1.6_r1/platforms/android-1.6/images -n avd16 -f -s HVGA

(2)  android.bat create avd -t 2 -c 256M -p

E:/android_sdk/android-sdk-windows-1.6_r1/platforms/android-1.6/images -n avd2 -f -s HVGA

        以上,用不同的設置創建avd.

   (3)  直接用”android.bat”命令可以啓動Android SDK圖開界面(如下圖),用它也可以創建avd;

      

(4)  在eclipse中,點擊工具欄中的“open the avd and SDK manager”圖標來打開上圖。

 

1.3   Lists existing targets or virtual devices

 

    E:/android_sdk/android-sdk-windows-1.6_r1/tools>android.bat list

    Available Android targets:

    id: 1

         Name: Android 1.5

         Type: Platform

         API level: 3

         Revision: 1

         Skins: HVGA (default), HVGA-L, HVGA-P, QVGA-L, QVGA-P

    id: 2

         Name: Android 1.6

         Type: Platform

         API level: 4

         Revision: 1

         Skins: HVGA (default), QVGA, WVGA800, WVGA854

    id: 3

         Name: Google APIs

         Type: Add-On

         Vendor: Google Inc.

         Revision: 3

         Description: Android + Google APIs

         Based on Android 1.5 (API level 3)

         Libraries:

          * com.google.android.maps (maps.jar)

              API for Google Maps

         Skins: QVGA-P, HVGA-L, HVGA (default), QVGA-L, HVGA-P

    id: 4

         Name: Google APIs

         Type: Add-On

         Vendor: Google Inc.

         Revision: 1

         Description: Android + Google APIs

         Based on Android 1.6 (API level 4)

         Libraries:

          * com.google.android.maps (maps.jar)

              API for Google Maps

         Skins: WVGA854, HVGA (default), WVGA800, QVGA

    Available Android Virtual Devices:

        Name: avd16

        Path: C:/Documents and Settings/lizhongyi/.android/avd/avd16.avd

      Target: Android 1.6 (API level 4)

        Skin: HVGA

    ---------

        Name: avd2

        Path: C:/Documents and Settings/lizhongyi/.android/avd/avd2.avd

      Target: Android 1.6 (API level 4)

        Skin: QVGA

 

1.4   Lists existing Android Virtual Devices

 

E:/android_sdk/android-sdk-windows-1.6_r1/tools>android list avd

      Available Android Virtual Devices:

          Name: avd16

          Path: C:/Documents and Settings/lizhongyi/.android/avd/avd16.avd

        Target: Android 1.6 (API level 4)

          Skin: HVGA

      ---------

          Name: avd2

          Path: C:/Documents and Settings/lizhongyi/.android/avd/avd2.avd

        Target: Android 1.6 (API level 4)

          Skin: QVGA

 

1.5   Lists existing targets

    E:/android_sdk/android-sdk-windows-1.6_r1/tools>android list target

    Available Android targets:

    id: 1

         Name: Android 1.5

         Type: Platform

         API level: 3

         Revision: 1

         Skins: HVGA (default), HVGA-L, HVGA-P, QVGA-L, QVGA-P

    id: 2

         Name: Android 1.6

         Type: Platform

         API level: 4

         Revision: 1

         Skins: HVGA (default), QVGA, WVGA800, WVGA854

    id: 3

         Name: Google APIs

         Type: Add-On

         Vendor: Google Inc.

         Revision: 3

         Description: Android + Google APIs

         Based on Android 1.5 (API level 3)

         Libraries:

          * com.google.android.maps (maps.jar)

              API for Google Maps

         Skins: QVGA-P, HVGA-L, HVGA (default), QVGA-L, HVGA-P

    id: 4

         Name: Google APIs

         Type: Add-On

         Vendor: Google Inc.

         Revision: 1

         Description: Android + Google APIs

         Based on Android 1.6 (API level 4)

         Libraries:

          * com.google.android.maps (maps.jar)

              API for Google Maps

         Skins: WVGA854, HVGA (default), WVGA800, QVGA

   

   

12    emulator.exe

2.1   啓動模擬器

  (1) 最簡單的方法(用avd):

emulator -avd avd2

(2) 按尺寸啓動模擬器

   emulator.exe -avd avd2 -scale 0.7

 

(3) 啓動userdata.img

  emulator -data userdata.img

 

(4) 啓動system.img

  emulator -data system.img

 

(5) 使用-verbose選項

 

E:/android_sdk/android-sdk-windows-1.6_r1/tools>emulator  -verbose -avd avd2

emulator: found SDK root at E:/android_sdk/android-sdk-windows-1.6_r1

emulator: root virtual device file at C:/Documents and Settings/lizhongyi/.android/avd/avd2.ini

emulator: virtual device content at C:/Documents and Settings/lizhongyi/.android/avd/avd2.avd

emulator: virtual device config file: C:/Documents and Settings/lizhongyi/.android/avd/avd2.avd/config.ini

emulator:     locking user data image at C:/Documents and Settings/lizhongyi/.android/avd/avd2.avd/userdata-qemu.img

emulator:     locking cache image at C:/Documents and Settings/lizhongyi/.android/avd/avd2.avd/cache.img

emulator: ignoring non-existing SD Card at C:/Documents and Settings/lizhongyi/.android/avd/avd2.avd/sdcard.img: No such file or directory

emulator: found skin 'QVGA' in directory: E:/android_sdk/android-sdk-windows-1.6_r1/platforms/android-1.6/skins

emulator: autoconfig: -skin QVGA

emulator: autoconfig: -skindir E:/android_sdk/android-sdk-windows-1.6_r1/platforms/android-1.6/skins

emulator: keyset loaded from: C:/Documents and Settings/lizhongyi/.android/default.keyset

emulator: trying to load skin file 'E:/android_sdk/android-sdk-windows-1.6_r1/platforms/android-1.6/skins/QVGA/layout'

emulator: skin network speed: 'full'

emulator: skin network delay: 'none'

emulator: registered 'boot-properties' qemud service

emulator: registered 'boot-properties' qemud service

emulator: Adding boot property: 'qemu.sf.lcd_density' = '120'

emulator: argv[00] = "emulator"

emulator: argv[01] = "-kernel"

emulator: argv[02] = "E:/android_sdk/android-sdk-windows-1.6_r1/platforms/android-1.6/images//kernel-qemu"

emulator: argv[03] = "-initrd"

emulator: argv[04] = "E:/android_sdk/android-sdk-windows-1.6_r1/platforms/android-1.6/images//ramdisk.img"

emulator: argv[05] = "-nand"

emulator: argv[06] = "system,size=0x4200000,initfile=E:/android_sdk/android-sdk-windows-1.6_r1/platforms/android-1.6/images//system.img"

emulator: argv[07] = "-nand"

emulator: argv[08] = "userdata,size=0x4200000,file=C:/Documents and Settings/lizhongyi/.android/avd/avd2.avd/userdata-qemu.img"

emulator: argv[09] = "-nand"

emulator: argv[10] = "cache,size=0x4200000,file=C:/Documents and Settings/lizhongyi/.android/avd/avd2.avd/cache.img"

emulator: argv[11] = "-serial"

emulator: argv[12] = "android-kmsg"

emulator: argv[13] = "-serial"

emulator: argv[14] = "android-qemud"

emulator: argv[15] = "-append"

emulator: argv[16] = "qemu=1 console=ttyS0 android.checkjni=1 android.qemud=ttyS1 android.ndns=1"

emulator: argv[17] = "-m"

emulator: argv[18] = "96"

emulator: mapping 'system' NAND image to C:/DOCUME~1/LIZHON~1/LOCALS~1/Temp//AndroidEmulator/TMP834.tmp

emulator: using 'winaudio' audio input backend

emulator: using 'winaudio' audio output backend

emulator: control console listening on port 5556, ADB on port 5557

emulator: sent '0012host:emulator:5557' to ADB server

emulator: ping program: E:/android_sdk/android-sdk-windows-1.6_r1/tools/ddms.bat

emulator: ping command: C:/WINDOWS/system32/cmd.exe /C "E:/android_sdk/android-sdk-windows-1.6_r1/tools/ddms.bat" ping emulator 1.11

 

(6) 使用- logcat 選項

  emulator  -logcat  main -avd avd2

 

(7) 使用-trace選項

E:/android_sdk/android-sdk-windows-1.6_r1/tools>emulator  -trace main(或events,或radio) -avd avd2

-- When done tracing, exit the emulator. --

emulator: emulator window was out of view and was recentred

或者:

E:/android_sdk/android-sdk-windows-1.6_r1/tools>emulator  -trace radio -trace main -trace radio -avd avd2

 

(7) 使用- kernel和-ramdisk選項

  E:/android_sdk/android-sdk-windows-1.6_r1/tools>emulator -kernel ../platforms/android-1.6/images/kernel-qemu -ramdisk ../platforms/android-1

.6/images/ramdisk.img -debug-kernel -verbose -avd avd2

 

(7) 使用- netfast選項

E:/android_sdk/android-sdk-windows-1.6_r1/tools>emulator  -netfast -avd avd2

 

 

2.2   使用模擬器控制檯

 每一個運行中的模擬器實例都包括一個控制檯,你可以利用控制檯動態的查詢和控制模擬設備的環境 。例如,你可以利用控制檯動態的管理端口映射和網絡特性,還可以模擬電話時間。要想進入控制檯輸入 命令,你需要使用telnet連接到控制檯的端口號。

 

可以使用下面的命令隨時隨地連接到任何一個運行中的模擬器實例:

 

telnet localhost 端口號

 

假設第一個模擬器實例的控制檯使用5554端口,下一個實例使用的端口號會加2,比如5556、5558…… 等。你可以在啓動模擬器是使用-verbose選項來檢測該模擬器實例使用的端口號,在調試 輸出的找到以”emulator console running on port number”這一行。 另外, 你可 以在命令行中使用adb devices來查看模擬器實例和他們的端口列表。最多可以有16個模擬 器實例同時運行控制檯。

 

(1)    進入控制檯

先在一個cmd窗口中啓動一個模擬器, 再打開一個cmd窗口,運行telnet命令,如下:

E:/android_sdk/android-sdk-windows-1.6_r1/tools> telnet localhost 5556

( 因爲在我的PC上,啓動了兩個模擬器, 一個用的是5554端口,另一個用的是5556端口.這裏,控制的是使用5556端口的模擬器)

進入後,如下圖:

 

 

(2)    gsm測試

 

輸入

gsm voice on

ok

則可以在模擬器上看到3G圖標,並且網絡圖標處於有信號狀態。

 

而執行

gsm voice off

ok

後,3G圖標消失,並且網絡圖標處於關閉(X)狀態。

 

gsm call 13522543026

ok

後,模擬器有如下反應:

 

 

 

(3)    sms測試

sms send 13522543026 hello

ok

則, 在模擬器的messaging中,就會看到有一條短信了.

如圖:

 

 

 

 

13    ddms.bat

    

3.1   直接啓動ddms

E:/android_sdk/android-sdk-windows-1.6_r1/tools>ddms

02:30 I/ddms: Created: [Debugger 8600-->568 inactive]

02:30 I/ddms: Created: [Debugger 8601-->617 inactive]

02:30 I/ddms: Created: [Debugger 8602-->619 inactive]

02:30 I/ddms: Created: [Debugger 8603-->657 inactive]

02:30 I/ddms: Created: [Debugger 8604-->670 inactive]

02:30 I/ddms: Created: [Debugger 8605-->681 inactive]

 

  

 

這和eclipse中的ddms是一樣的.

 

 

 

4     adb

 

1.14.1        Adb help:

 

直接運行adb會顯示出adb的help信息.如下:

 

E:/android_sdk/android-sdk-windows-1.6_r1/tools>adb -help

Android Debug Bridge version 1.0.22

 

 -d                            - directs command to the only connected USB device

                                 returns an error if more than one USB device is present.

 -e                            - directs command to the only running emulator.

                                 returns an error if more than one emulator is running.

 -s <serial number>            - directs command to the USB device or emulator with

                                 the given serial number

 -p <product name or path>     - simple product name like 'sooner', or

                                 a relative/absolute path to a product

                                 out directory like 'out/target/product/sooner'.

                                 If -p is not specified, the ANDROID_PRODUCT_OUT

                                 environment variable is used, which must

                                 be an absolute path.

 devices                       - list all connected devices

 

device commands:

  adb push <local> <remote>    - copy file/dir to device

  adb pull <remote> <local>    - copy file/dir from device

  adb sync [ <directory> ]     - copy host->device only if changed

                                 (see 'adb help all')

  adb shell                    - run remote shell interactively

  adb shell <command>          - run remote shell command

  adb emu <command>            - run emulator console command

  adb logcat [ <filter-spec> ] - View device log

  adb forward <local> <remote> - forward socket connections

                                 forward specs are one of:

                                   tcp:<port>

                                   localabstract:<unix domain socket name>

                                   localreserved:<unix domain socket name>

                                   localfilesystem:<unix domain socket name>

                                   dev:<character device name>

                                   jdwp:<process pid> (remote only)

  adb jdwp                     - list PIDs of processes hosting a JDWP transport

  adb install [-l] [-r] <file> - push this package file to the device and install it

                                 ('-l' means forward-lock the app)

                                 ('-r' means reinstall the app, keeping its data)

  adb uninstall [-k] <package> - remove this app package from the device

                                 ('-k' means keep the data and cache directories)

  adb bugreport                - return all information from the device

                                 that should be included in a bug report.

 

  adb help                     - show this help message

  adb version                  - show version num

 

DATAOPTS:

 (no option)                   - don't touch the data partition

  -w                           - wipe the data partition

  -d                           - flash the data partition

 

scripting:

  adb wait-for-device          - block until device is online

  adb start-server             - ensure that there is a server running

  adb kill-server              - kill the server if it is running

  adb get-state                - prints: offline | bootloader | device

  adb get-serialno             - prints: <serial-number>

  adb status-window            - continuously print device status for a specified device

  adb remount                  - remounts the /system partition on the device read-write

  adb reboot [bootloader|recovery] - reboots the device, optionally into the bootloader or recovery program

  adb root                     - restarts adb with root permissions

 

networking:

  adb ppp <tty> [parameters]   - Run PPP over USB.

 Note: you should not automatically start a PPP connection.

 <tty> refers to the tty for PPP stream. Eg. dev:/dev/omap_csmi_tty1

 [parameters] - Eg. defaultroute debug dump local notty usepeerdns

 

adb sync notes: adb sync [ <directory> ]

  <localdir> can be interpreted in several ways:

 

  - If <directory> is not specified, both /system and /data partitions will be updated.

 

-          If it is "system" or "data", only the corresponding partition

    is updated.

 

 

 

14.2        scripting:

(1) start adb server

方法1: E:/android_sdk/android-sdk-windows-1.6_r1/tools>adb kill-server

 

E:/android_sdk/android-sdk-windows-1.6_r1/tools>adb start-server

* daemon not running. starting it now *

* daemon started successfully *

E:/android_sdk/android-sdk-windows-1.6_r1/tools>

 

方法2: E:/android_sdk/android-sdk-windows-1.6_r1/tools>adb kill-server

 

E:/android_sdk/android-sdk-windows-1.6_r1/tools>adb fork-server server

OK

 

注意: 方法1是直接用adb的scripting “adb start-server” 來啓動的, 啓動成功後,直接返回到cmd命令窗口;

方法2 是用直接啓動adb server進程的方式” adb fork-server server”來啓動的,啓動成功後, 顯示”OK”, 並且不返回到cmd命令窗口.

分析: 這是因爲adb.exe是一個命令(可執行程序), 它啓動後,會調用到” adb fork-server server”(這個server正是adb server), 然後, adb.exe就退出了,這時,只剩下adb server 這個進程了,這個進程的名字也是adb.exe.而方法2是直接啓動adb server,所以,不能退出,如果退出,就相當於adb server退出了.

adb server啓動後,會在任務管理器中進程中可以看到adb.exe.

如果用戶將adb.exe 強行結束了,那麼, 對於方法2,就會回到cmd窗口.

另外,如果eclipse中啓動了模擬器,那麼, 強行結束adb server後, 會再啓動一個.

 

(2) adb get-state and get-serialno

E:/android_sdk/android-sdk-windows-1.6_r1/tools>adb get-state

device

 

E:/android_sdk/android-sdk-windows-1.6_r1/tools>adb get-serialno

emulator-5554

 

如果同時啓動了兩個模擬器,則這兩個腳本的執行結果均是:

unknown

 

(3) adb root

     E:/android_sdk/android-sdk-windows-1.6_r1/tools>adb root

adbd is already running as root

 

adb reboot recovery

(4) adb reboot [android-sdk-windows-1.6_r1支持]

adb reboot bootloader(或 recovery)

說明:reboots the device, optionally into the bootloader or recovery program,可見,只針對真機,

所以,當運行此腳本時,模擬器就不能運行了。

另外,此腳本是從android-sdk-windows-1.6_r1開始支持的。

 

1.12.3        device commands:

(1) list all connected devices

E:/android_sdk/android-sdk-windows-1.6_r1/tools>adb devices

List of devices attached

emulator-5554   device

emulator-5556   device

 

(2) adb shell

  開機:

      E:/android_sdk/android-sdk-windows-1.6_r1/tools>adb shell

      # ls

      ls

      sqlite_stmt_journals

      cache

      sdcard

      etc

      system

      sys

      sbin

      proc

      init.rc

      init.goldfish.rc

      init

      default.prop

      data

      root

      dev

      # cd data

      cd data

      # ls

      ls

      misc

      local

      data

      app-private

      app

      property

      anr

      dalvik-cache

      system

      lost+found

     

      # cd data

      cd data

      # pwd

      pwd

      /data/data

      # ls -l

      Ls -l

      # ls -l

      ls -l

      drwxr-xr-x app_0    app_0             2009-11-25 02:42 com.android.packageinstaller

      drwxr-xr-x app_1    app_1             2009-11-25 02:42 com.android.providers.contacts

      drwxr-xr-x app_2    app_2             2009-11-25 02:42 com.android.fallback

      drwxr-xr-x app_1    app_1             2009-11-25 02:42 com.android.inputmethod.latin

      drwxr-xr-x app_3    app_3             2009-11-25 02:42 com.android.gesture.builder

      drwxr-xr-x app_4    app_4             2009-11-25 02:42 com.google.android.marvin.talkback

      drwxr-xr-x app_5    app_5             2009-11-25 02:42 com.android.providers.downloads

      drwxr-xr-x app_1    app_1             2009-11-25 02:42 com.android.inputmethod.pinyin

      drwxr-xr-x system   system            2009-11-25 02:42 com.android.providers.settings

      drwxr-xr-x app_6    app_6             2009-11-25 02:42 com.android.development

      drwxr-xr-x app_7    app_7             2009-11-25 02:42 com.android.email

      drwxr-xr-x app_8    app_8             2009-11-25 02:42 com.android.music

      drwxr-xr-x app_1    app_1             2009-11-25 02:42 com.android.globalsearch

      drwxr-xr-x app_9    app_9             2009-11-25 02:42 jp.co.omronsoft.openwnn

      drwxr-xr-x app_10   app_10            2009-11-25 02:42 com.android.mms

      drwxr-xr-x app_5    app_5             2009-11-25 02:42 com.android.camera

      drwxr-xr-x app_11   app_11            2009-11-25 02:42 com.android.term

      drwxr-xr-x system   system            2009-11-25 02:42 com.android.settings

      drwxr-xr-x app_12   app_12            2009-11-25 02:42 com.android.browser

      drwxr-xr-x app_13   app_13            2009-11-25 02:42 android.tts

      drwxr-xr-x app_14   app_14            2009-11-25 02:42 com.android.customlocale

      drwxr-xr-x app_1    app_1             2009-11-25 02:42 com.android.providers.userdictionary

      drwxr-xr-x app_15   app_15            2009-11-25 02:42 com.android.soundrecorder

      drwxr-xr-x app_16   app_16            2009-11-25 02:42 com.android.netspeed

      drwxr-xr-x radio    radio             2009-11-25 02:43 com.android.phone

      drwxr-xr-x app_1    app_1             2009-11-25 02:43 com.android.contacts

      drwxr-xr-x app_17   app_17            2009-11-25 02:43 com.android.htmlviewer

      drwxr-xr-x system   system            2009-11-25 02:43 com.android.server.vpn

      drwxr-xr-x app_1    app_1             2009-11-25 02:43 com.google.android.providers.enhancedgooglesearch

      drwxr-xr-x app_18   app_18            2009-11-25 02:43 com.android.sdksetup

      drwxr-xr-x app_4    app_4             2009-11-25 02:43 com.google.android.marvin.soundback

      drwxr-xr-x app_5    app_5             2009-11-25 02:43 com.android.providers.drm

      drwxr-xr-x app_1    app_1             2009-11-25 02:43 com.android.launcher

      drwxr-xr-x app_1    app_1             2009-11-25 02:43 com.android.providers.applications

      drwxr-xr-x app_19   app_19            2009-11-25 02:43 com.svox.pico

      drwxr-xr-x app_5    app_5             2009-11-25 02:43 com.android.providers.media

      drwxr-xr-x app_20   app_20            2009-11-25 02:43 com.android.calculator2

      drwxr-xr-x app_4    app_4             2009-11-25 02:43 com.google.android.marvin.kickback

      drwxr-xr-x radio    radio             2009-11-25 02:43 com.android.providers.telephony

      drwxr-xr-x app_21   app_21            2009-11-25 02:43 com.android.alarmclock

      drwxr-xr-x app_22   app_22            2009-11-25 02:43 com.android.spare_parts     

  先後啓動kx011和a兩個應用程序(都是activity),則,

     在/data/data下,就會看到如下兩個應用了,

     # ls

     a.a

     com.kx011

  而且,在/data/app下,也有這兩個應用的apk文件。

     # cd /data/app

      cd /data/app

      # ls

      ls

      com.kx011.apk

      a.a.apk

     

      說明:在/data/data目錄下,存放了所有系統已經啓動的的應用程序;

            在/data/app下,以apk的形式存放了用戶建立的應用。

 

(3)adb pull      // 說明:copy file/dir from device

      E:/android_sdk/android-sdk-windows-1.6_r1/tools>adb pull /init.rc F:/ABD/x.txt

668 KB/s (10700 bytes in 0.015s)

 

          adb push <local> <remote>    - copy file/dir to device

    adb pull <remote> <local>    - copy file/dir from device

 

(4)adb push  // 說明:copy file/dir to device

     E:/android_sdk/android-sdk-windows-1.6_r1/tools>adb push ddms.bat /data/

     124 KB/s (1992 bytes in 0.015s)

  

 

(5) adb install

E:/android_sdk/android-sdk-windows-1.6_r1/tools>adb install D:/allProject/android16/kx011/bin/kx011.apk

259 KB/s (8297 bytes in 0.031s)

        pkg: /data/local/tmp/kx011.apk

Success

#

說明: install 完成之後,直接進入adb shell

 

 

(6) adb jdwp

    E:/android_sdk/android-sdk-windows-1.6_r1/tools>adb jdwp

    567

    614

    616

    641

    661

    678

    707

    714

 

(7) adb bugreport

   列出了bug信息,see to bugreport.txt    [ 點擊查看 ]

 

 

13    關於編譯

 

1.13.1        am:

 

adb install c:/NetScramble_1.1.apk

adb shell rm data/app/NetScramble_1.1.apk

am start -n net.xiashou.android/net.xiashou.android.HelloAndroid

# am start -a android.intent.action.VIEW -d http://www.xiashou.net

# am start -a android.intent.action.CALL -d tel:10086

# am start -a android.intent.action.VIEW geo:0,0?q=tianjin

# am start –n com.android.music/.MediaPlaybackActivity

 

1.13.2        重新編譯源碼

   當然,這是在linux下面進行的。

(1) 編譯源碼

解壓原碼到本地,進入原碼目錄,執行: make, 即可。

 

(2) 編譯SDK

在make完成後,直接make sdk,會在out/host/linux-x86/sdk下面生成mdk文件及文件夾,形如:android-sdk_eng.xxx_linux-x86

 

(3) 編譯單個模塊

     1.先將system文件夾移出,

     2.在android目錄下執行

              $ . build/envsetup.sh

     3. 然後你就會多出幾個可用的命令。在改了Contacts聯繫人項目後,可以簡單的執行一下命令來單獨編譯這個部分:

              $mmm packages/apps/Contacts/

         或者在src目錄下直接運行make module name :

         cd ~/android/src

         make Contacts

     4.將新生成的system文件夾覆蓋原system文件夾

     5.然後編譯system.img

      ./out/host/linux-x86/bin/mkyaffs2image -f out/target/product/generic/system out/target/product/generic/system.img

      第二次mmm需將/out/target/product/generic/obj/全部拷回!!!

     (mmm命令非常的多管閒事,它每次編譯都把obj刪了!!!)

      輸出cmd命令到文件

           dir > a.log

 

4     系統信息

由於篇幅的原因,這裏,只給出鏈接,分別列出了process, memory info, init log, bugreport信息。值得注意的是,bugreport 中包含了前三項。另外,process和memory info是從真機中導出來的,init log 和bugreport是從模擬器拿到的,而且,取得的日期時間都不一致。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章