在开机的时候,默认开启USB调试,这对开发来说提供了方便。至于如何做到开机开启USB调试,进行如下操作:

      1. 修改Android SDK/frameworks/base/services/java/com/android/server/usb/UsbDeviceManager.java

        public void systemReady() {
            if (DEBUG) Slog.d(TAG, "systemReady");
            mNotificationManager = (NotificationManager)
                mContext.getSystemService(Context.NOTIFICATION_SERVICE);


        // We do not show the USB notification if the primary volume supports mass storage.
        // The legacy mass storage UI will be used instead.
        boolean massStorageSupported = false;
        final StorageManager storageManager = StorageManager.from(mContext);
        final StorageVolume primary = storageManager.getPrimaryVolume();
        massStorageSupported = primary != null && primary.allowMassStorage();
        mUseUsbNotification = !massStorageSupported;


        // make sure the ADB_ENABLED setting value matches the current state
        //Settings.Global.putInt(mContentResolver, Settings.Global.ADB_ENABLED, mAdbEnabled ? 1 : 0);
        //modify by skm@2014 support usb dbg on boot  
        Settings.Global.putInt(mContentResolver, Settings.Global.ADB_ENABLED, 1); //开机默认开启usb调试
        mHandler.sendEmptyMessage(MSG_SYSTEM_READY);
    }

  2. 重新编译

      #cd   Android SDK/frameworks/base/services/java   

      #mm

      重新生成新的service.jar,将service.jar拷贝到设备的/system/framework/目录下,替换原来的,重新开机即可自动开启usb调试


  3. adb 使用小插曲

    I. adb USB连接

    #adb devices  //查看当前连接上的adb 设备

    #adb shell       //如果只有一台设备,则直接连接上去,如有多台设备,需要执行#adb -s xxx shell

    

     II. adb 网络连接

    1. 通过串口到设备终端设置adb网络连接属性,这个需要以root权限进入

        #setprop service.adb.tcp.port 5555

#stop adbd

#start adbd

#buxybox ifconfig //查看设备端的ip地址

2. 在windows上打开命令行终端

#adb connect 192.168.1.xxx //设备地址

#adb get-state //查看连接是否成功

#adb shell //进行连接

 

个人开发来说,比较喜欢用网络进行连接,adb网络连接就可以避开用豌豆荚,百度助手这种工具,没有用这种工具直接用adb shell连接不上,估计是没有设置好驱动的原因,使用第三方工具总是往里面安装些乱七八糟的东西,不方便调试。

 





更多相关文章

  1. Nginx系列教程(六)| 手把手教你搭建 LNMP 架构并部署天空网络电影
  2. Android(安卓)以太网(有线网络)开关和状态的判断
  3. mac 下真机调试 android 手机
  4. MTK 平台支持设备树的添加流程
  5. Activity学习(一):生命周期
  6. Android(安卓)使用 adb命令 远程安装apk
  7. android 2.3 wifi (一)
  8. Android(安卓)手机上获取物理唯一标识码
  9. Android(安卓)- Volley的ImageLoader下载图片

随机推荐

  1. ubuntu14.04下qemu调试linux内核
  2. 转:6410下点亮led
  3. Linux常用命令汇总-速查
  4. Linux 3.4.39内核编译配置选项介绍
  5. linux shell脚本编程笔记(四): 获取字符串长
  6. linux apache安装https证书
  7. 有什么办法可以在Windows上不用使用太繁
  8. 线程同步-生产者消费者问题
  9. linux下touch命令也可以一次创建多个文件
  10. linux如何处理多连接请求?