Ubuntu 配置 Android开发 adb调试

让人想犯罪 __ 提交于 2020-01-10 11:07:23

【推荐】2019 Java 开发者跳槽指南.pdf(吐血整理) >>>

Ubuntu/Linux setup device/android for adb

参考官方说明 在Ubntu下开发Android开发调试JNI比Windows下用Cygwin方便,现总结下简单配置

  • In the AndroidManifest.xml file, add android:debuggable="true" to the <application> element.

  • Enable USB debugging on your device

  • Set up your system to detect your device

    • 添加一个相应规则 create this file: /etc/udev/rules.d/51-android.rules 从官方查 USB Vendor IDs,比如华为是12d1

        SUBSYSTEM=="usb", ATTR{idVendor}=="<USB Vendor ID>", MODE="0666", GROUP="plugdev" 
      
    • Now execute:

        chmod a+r /etc/udev/rules.d/51-android.rules
      
    • restart adb

      adb kill-server
      adb devices # start and list deivces  
      
  • 重新插拔设备

  • 问题: adb devices 看不到设备,一般是Android手机 ProjectMenuLogusb port set 设置问题。以华为C8812为例:拨号 *#*#2846579#*#* 进入试菜单界面,设置 logverbosedump log, usb port set 设为 Google mode

    # not work
    ~/adb devices
    List of devices attached 
    ????????????   devices
    #or
    List of devices attached 
    <nothing>
    
    # adb devices works
    ~/adb devices
    List of devices attached 
    0C37DC322826    devices
    
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!