mac os 用真機調試android應用

首先,要安裝filetransfer.dmg程序,才能把android機鏈接到mac os上面android

 

1,設置adb的環境變量shell

  查找android tools所在的目錄,在android tools下面有adb工具,目錄以下「/Users/fenghewei/Android/Android_tools/android-sdk-macosx/platform-tools」,把這路徑加入到~/.bash_profile文件中macos

#adb
ANDROID_ADB=/Users/fenghewei/Android/Android_tools/android-sdk-macosx/platform-tools
export PATH=$PATH:$ANDROID_ADB

執行:source ~/.bash_profile讓文件當即生效bash

2,查看設置是否生效工具

  ~ adb version
Android Debug Bridge version 1.0.32
Revision 09a0d98bebce-android

3,連接手機,把手機的鏈接方式設置爲"內置光盤"的模式。ui

4,system_profiler SPUSBDataType 找到設備的Vendor ID
調試

M81:
          Product ID: 0x0c03
          Vendor ID: 0x2a45
          Version: ff.ff
          Serial Number: 810EBMA3U25H
          Speed: Up to 480 Mb/sec
          Manufacturer: Meizu
          Location ID: 0x14100000 / 15
          Current Available (mA): 1000
          Current Required (mA): 500
          Extra Operating Current (mA): 0
          Capacity: 14.3 MB (14,297,808 bytes)
          Removable Media: Yes
          Detachable Drive: Yes
          BSD Name: disk4
          Partition Map Type: Unknown
          Volumes:
            iAmCdRom:
              Capacity: 3.1 MB (3,110,912 bytes)
              Available: Zero KB
              Writable: No
              File System: ISO Joliet
              BSD Name: disk4s0
              Mount Point: /Volumes/iAmCdRom
              Content: CD_ROM_Mode_2_Form_1

5,將vendor ID加入到~/.android/adb_usb.ini文件中,若是adb_usb.ini文件不存在,新建這個文件code

6,在開發人工具裏面使能"USB調試",並重啓adb服務orm

➜  ~ adb kill-server
➜  ~ adb devices
List of devices attached
810EBMA3U25H	device

7,如今能夠在android studio工具裏面使用設備調試了。  server

相關文章
相關標籤/搜索