android studio 解决debug adb端口问题,亲身经历总结

前提:使用androidstudio

步骤:

一.检查AndroidManifest.xml文件下的  application 属性中的android:debuggable="true"(如果是false,则无法debug)

二.检查app工程下的gradle文件,要把debuggable设为true

buildTypes {
    debug {
        debuggable true
    }
    release {
        debuggable true
    }
}
三.设置 tools->android->Enable ADB Integration,勾选上

四.检查adb的端口是否被占用,adb的端口一般为5037,在命令行中敲下netstat -aon|findstr "5037" ,检查占用了adb的程序      pid,然后在windows的程序管理器中结束掉该程序

     1.一般比较流氓的有360手机助手和360程序(必要情况下卸载这2个PC端软件)

     2.如果用搜狗浏览器的话,要在程序管理器中结束掉sougouphoneservice.exe程序

     3.电脑腾讯qq的,要干掉tadb.exe程序和AndroidServer.exe程序

     4.豌豆荚的占用端口(不用豌豆荚,不知道是pc端占用还是手机端占用,可自行验证)

五.华为手机可能无法打印log,可在华为手机中设置log打开

    1.http://blog.csdn.net/scwhy/article/details/7432414(有的华为手机可能无效)

    2.http://t.cn/R5Wl0Ix

    3.http://bbs.zhiyoo.com/thread-6077828-1-1.html




猜你喜欢

转载自blog.csdn.net/qq_19822039/article/details/51753560